The Economics of Self-Hosted AI: TCO Analysis for SMEs
The Economics of Self-Hosted AI: TCO Analysis for SMEs
Everyone talks about “run your own AI” like it’s either a magic bullet or a fool’s errand. The reality is more interesting — and more nuanced. We’ve been running a full local AI stack for six months on an NVIDIA DGX Spark (ARM64), and we have the receipts. Here’s an honest TCO breakdown.
Why This Matters
European SMEs face a unique pressure: the EU AI Act demands data sovereignty, cloud API costs scale unpredictably with usage, and vendor lock-in creates strategic risk. But “just self-host” isn’t advice — it’s a decision that needs numbers behind it.
We run J4SGON S.L., a small AI consulting company in Valencia. Our stack serves three brands: VORLUX AI (consulting), Apprendere Hub (Docebo expertise), and J4SGON (content). We need LLMs for chat, RAG retrieval, code generation, script writing, and content pipelines.
This is our actual cost analysis — not a hypothetical.
The Setup: What We Run
Our DGX Spark (ARM64) hosts:
| Service | Purpose | Stack |
|---|---|---|
| LiteLLM | Model router/gateway | Routes all LLM calls, provides fallback, spend tracking |
| Ollama | Local model serving | qwen3.6:35b, llama3.1:8b, bge-m3 (embeddings) — 16 models resident |
| vLLM | High-throughput inference | qwen2.5-7b for fast tasks |
| Qdrant | Vector database | 9 collections, 6,915 + 3,638 points, hybrid search |
| Langfuse | LLM tracing | Every model call traced, costed, evaluated |
| SearXNG | Private web search | Replaces Google API for agents |
| n8n | Workflow automation | Content pipeline, blog generation, notifications |
| R2R | RAG ingestion | Document processing pipeline |
| ComfyUI | Image generation | Thumbnails, scene illustrations |
| Kokoro TTS | Text-to-speech | YouTube pipeline voiceover |
| Whisper STT | Speech-to-text | Subtitle generation |
| LibreChat | Team chat UI | All local models accessible to team |
| Open WebUI | Model playground | Experimentation, testing |
That’s 52 containers running 24/7 on a single machine, serving 16 local models through Ollama. Both numbers were smaller when I first wrote this section, which is its own kind of data point: self-hosted estates grow because adding the seventeenth model costs nothing but disk.
The Hardware Cost
NVIDIA DGX Spark: ~€2,800 (one-time)
- ARM64 architecture (Grace CPU)
- 128 GB unified memory
- Embedded GPU (sufficient for 7B-32B models)
- Low power consumption (~65W typical)
Storage: 1 TB NVMe SSD — ~€120 Network: Existing broadband (€35/month, shared with household)
Total hardware: ~€2,920 one-time
The Operating Costs
Electricity
The DGX Spark draws approximately 65W under typical load. At Spanish residential rates (~€0.15/kWh in 2026):
- 65W × 24h × 365d = 569 kWh/year
- €85/year in electricity
For comparison, a single RTX 4090 workstation draws ~450W under load — that’s €593/year just in power. The ARM64 efficiency is a real advantage.
Maintenance & Time
This is the cost most analyses skip. Self-hosting requires human time:
- Initial setup: ~40 hours (one-time)
- Daily maintenance: ~30 min/day (monitoring, updates, troubleshooting)
- Model updates: ~2 hours/month (pulling new models, testing, switching)
- Incident response: ~1 hour/month average (container crashes, disk space, networking)
At a consulting rate of €80/hour (our standard), that’s:
- Setup: €3,200 (one-time, amortized over 3 years = €1,067/year)
- Daily ops: €7,300/year (but much of this is automated via our own AI agent — MYLA — which reduces effective human time to ~15 min/day)
- Effective maintenance cost: ~€4,650/year with automation
Software Licensing
Everything we run is open source. €0 in software licenses.
The only subscription cost is our domain names and Vercel hosting for static sites (~€20/month for Pro). Cloudflare Workers free tier covers our API.
The Cloud Alternative: What Would It Cost?
Let’s price the equivalent stack using cloud APIs for our actual usage:
LLM Inference
Our monthly usage (measured via Langfuse):
- Chat completions: ~15,000 requests/month (client consulting + internal tools)
- Average tokens: 2,000 input + 500 output per request
- Embeddings: ~50,000 requests/month (RAG indexing + search)
| Provider | Chat (15K req) | Embeddings (50K req) | Monthly Total |
|---|---|---|---|
| OpenAI GPT-4o | €1,125 | €5 | €1,130 |
| OpenAI GPT-4o-mini | €113 | €5 | €118 |
| Anthropic Claude 3.5 Sonnet | €900 | (via Voyage) | €920 |
| Google Gemini 1.5 Pro | €675 | €5 | €680 |
We use qwen3.6 (32B) as primary, which rivals GPT-4o-mini quality at zero marginal cost. Realistic cloud equivalent: €120-€1,130/month depending on model choice.
Vector Database
Qdrant Cloud (equivalent to our 7K vectors + hybrid search):
- Serverless tier: €50/month minimum for production usage
Workflow Automation
Zapier equivalent to our n8n workflows:
- Professional plan: €25/month (limited runs)
- We run ~3,000 workflow executions/month — would need Team plan: €80/month
Web Search API
Google Custom Search or Serper API for agent search:
- ~2,000 queries/month: €10-€20/month
Image Generation
DALL-E 3 or Midjourney for thumbnails/illustrations:
- ~100 generations/month: €20-€40/month
TTS/STT
ElevenLabs equivalent for our YouTube pipeline:
- Creator plan: €22/month (limited to 30 min audio)
- We generate ~45 min/month — would need Pro: €99/month
Cloud TCO Summary
| Component | Low Estimate | High Estimate |
|---|---|---|
| LLM inference | €118/mo | €1,130/mo |
| Vector DB | €50/mo | €50/mo |
| Workflow automation | €80/mo | €80/mo |
| Web search | €10/mo | €20/mo |
| Image generation | €20/mo | €40/mo |
| TTS/STT | €22/mo | €99/mo |
| Monthly total | €300 | €1,419 |
| Annual total | €3,600 | €17,028 |
Self-Hosted TCO Summary
| Component | Annual Cost |
|---|---|
| Hardware (amortized 3 years) | €973 |
| Electricity | €85 |
| Maintenance (automated) | €4,650 |
| Software licenses | €0 |
| Domains + hosting | €240 |
| Annual total | €5,948 |
The Break-Even Analysis
At the low cloud estimate (€3,600/year), self-hosting is more expensive by ~€2,348/year. But this assumes you only need GPT-4o-mini quality and modest usage.
At the high cloud estimate (€17,028/year), self-hosting saves €11,080/year.
The break-even point is approximately €500/month in cloud API spend. If you’re spending less than that, cloud is cheaper. If you’re spending more, self-hosting wins decisively.
The Scaling Factor
Here’s where it gets interesting. Our cloud costs would scale linearly with usage. Last month, we processed 15,000 LLM calls. Next year, with client growth, we expect 50,000+/month. That pushes the cloud bill to €1,000-€3,700/month — but our self-hosted cost stays flat at ~€500/month.
Self-hosting has a fixed cost curve. Cloud has a linear cost curve. The more you use, the more self-hosting makes sense.
Hidden Costs We Learned About
The four below are the ones every self-hosting guide mentions. The three after them are the ones that actually cost me time, and I have not seen them in anyone else’s TCO.
1. Model Quality Gap
Local 7B-32B models are good but not GPT-4o-level. For complex reasoning, we sometimes route to stronger models. If you need frontier-level quality for every call, self-hosting alone won’t cut it — you’ll need a hybrid approach (local for 80% of calls, cloud for the hard 20%).
2. RAM is the Real Constraint
128 GB unified memory sounds like a lot. Running qwen3.6 (32B) in Q4_K_M takes ~20 GB. Add vLLM’s qwen2.5-7b (~5 GB), embeddings model (~2 GB), plus all the containers (~8 GB), and you’re at 35 GB. You can run 3-4 models simultaneously — not more. If you need many specialized models, you’ll need more hardware.
3. Networking Time Sink
Docker networking between containers and host services was our single biggest time sink. Containers couldn’t reach host-native services (Ollama, LiteLLM) without network_mode: host or host.docker.internal configuration. We spent ~15 hours debugging this over two weeks. Document your networking setup early.
4. GPU Scheduling Conflicts
Only one model can use the GPU at a time for inference (with our single-GPU setup). vLLM and Ollama competing for GPU memory caused OOM crashes until we configured model keep-alive and load scheduling. Plan your model rotation.
5. The monitoring tool took the database down
On 2026-08-15 our orchestrator database wedged for about an hour and a half. Every write
blocked. Every store logged the same two lines: writer-mutex held 30.03s, then
gave up after 6 attempts (database is locked).
The cause was the thing I had installed to look at the database. A long-lived read-only
SHM holder — Datasette — had left a stale reader-mark in the WAL index, which put SQLite into
a “WAL recovery needed” state that recovery could not itself complete. No fcntl lock was
held, so nothing looked wrong from the outside. Restarting the process did not clear it,
because the wedge lived in the -shm file, not in the process.
The fix was to probe BEGIN IMMEDIATE on each WAL database at startup and, if it blocks
and no real writer holds an fcntl write lock, back up the -shm, clear it, and let the
first writer run recovery. Committed data was never at risk — the -shm is a pure cache.
Cost: ninety minutes of downtime, and the better part of a day understanding it well enough to be sure the self-heal could not eat data. No cloud bill line covers that. No cloud provider would have let it happen either — that is the honest trade.
6. Losing to your own lock
2026-06-29. A crash, then a root-cause analysis that took three days to close.
Writes were burning the full 30-second busy_timeout per attempt and giving up after four.
The reason was embarrassing and instructive: we had a process-wide mutex protecting writers,
and it worked perfectly — for the writers inside it. Two memory stores sat outside it with
their own private locks and fought the guarded writers at the SQLite level. A mutex that does
not cover every writer is not a mutex, it is a suggestion.
Worse, a multi-statement function that failed halfway left an open implicit transaction that
pinned the write lock for the entire lifetime of that connection. The fix raised retries from
four to six, lifted the backoff ceiling from two seconds to ten, and — the part that actually
mattered — added a best-effort rollback() on lock error and on give-up, so a half-applied
transaction can never pin the lock again.
7. The deploy that failed forever, by itself
lftp mirror, interrupted mid-run, leaves orphan .in.<filename>. lock files on the remote.
Every subsequent deploy then dies with 550 ... Temporary hidden file ... already exists —
and stays dead until a human logs in and deletes them by hand. Three consecutive deploys
failed this way before anyone noticed.
The same pipeline had already taught us a related lesson: a workflow that set both paths
and paths-ignore on one event matched nothing at all and ran zero times for over a day,
while the dashboard stayed green. Green is not the same as working. Budget for the hours
you will spend proving that difference.
Add these up honestly and the “maintenance” line in any self-hosting TCO is not the two
hours a month the vendor comparison assumes. Ours has averaged closer to six — most months
nothing, and then one month where a -shm file eats your afternoon. Self-hosting is still
cheaper for us. It is not cheaper because it is less work.
Hidden Benefits Most People Miss
1. Data Never Leaves Your Building
For consulting clients under NDA, this is a sales advantage, not just compliance. We can tell prospects: “Your data never leaves our server in Valencia.” That closes deals the cloud can’t.
2. Zero Rate Limits
No API rate limits, no token caps, no “please upgrade your plan.” Our pipeline can fire 1,000 requests in a minute if needed. Cloud APIs would throttle or charge premium for this.
3. Latency
Local inference on ARM64 with 7B models: 80-120ms TTFT (time to first token). Cloud API round-trip: 400-800ms. For interactive chat and real-time agent workflows, this matters enormously.
4. Offline Capability
Our stack runs without internet. When Spanish internet had a 4-hour outage in July 2026, we kept working. Cloud-only shops were dead in the water.
5. Full Observability
Langfuse traces every single call with full input/output, token counts, latency, and cost — because it’s local, there’s no data sampling or privacy concern. Cloud providers give you usage metrics, not deep observability.
The Verdict
Self-hosting AI makes economic sense when:
- Your monthly cloud API spend exceeds €500
- You process sensitive/client data (sovereignty requirement)
- You need high-volume, low-latency inference
- You have team members who can handle basic sysadmin work
- You want predictable, flat costs instead of usage-based billing
Cloud APIs are better when:
- You’re just starting and usage is low (<€500/month)
- You need frontier-level model quality on every call
- You have no one to maintain infrastructure
- Your workload is bursty and unpredictable
For J4SGON, the math is clear: self-hosting saves us €5,000-€11,000/year, gives us a competitive advantage in data-sensitive consulting, and provides better latency for our agent pipelines. The initial setup investment pays for itself within 6-12 months depending on your usage trajectory.
The ARM64 ecosystem has matured significantly. Most major models now ship ARM64-native builds. Docker supports it. The tooling works. If you’ve been waiting for self-hosting AI to “be ready” — it’s ready.
References and further reading
- SQLite: Write-Ahead Logging — why the
-shmfile exists, and why clearing it is safe when no writer holds a lock - SQLite:
busy_timeoutand locking — the behaviour behind the retry numbers above - Ollama · vLLM · LiteLLM — the serving and routing layer
- Qdrant — vector database, and its hybrid search docs
- Langfuse — the tracing that made per-call cost visible in the first place
- n8n · SearXNG · ComfyUI
- EU AI Act, full text — the sovereignty pressure this whole analysis sits under
- GitHub Actions:
pathsandpaths-ignore— you may not use both on one event
This analysis reflects J4SGON’s actual infrastructure costs as of August 2026. Your numbers will vary based on hardware, electricity rates, usage patterns, and model choices. Run your own numbers — but use ours as a starting reference.
J4SGON S.L. builds sovereign AI infrastructure for European businesses. Learn more at vorluxai.com.
Tell us what you are integrating or migrating
Send the platform, the systems involved and where you are stuck. You get a written scope back — phases, deliverables and what is out of scope — before anything is billed.