Why Self‑Hosting LLMs Beats Rising Token Prices
Even though token usage feels like a cheap, invisible metric today, the reality is that most AI providers are operating at a loss, subsidised by big‑tech cash reserves. As funding dries up, token prices will inevitably rise—often in sudden spikes. For organisations that have already embedded LLM‑driven logic into their workflows, those price hikes can quickly become a serious financial concern.
The hidden cost of tokens
Tokens are not a market‑driven commodity. They are an internal accounting unit that providers can price arbitrarily. Recent events—Microsoft cutting its Claude Code licence after cost overruns—demonstrate that when providers are forced to treat AI as a regular business, token prices can jump dramatically.
- Even a 10 % increase can erode margins on high‑volume agents.
- Repeated 10 % hikes (three‑four times a year) force a strategic review of AI spend.
- Tool‑heavy agents (retrieval, reasoning, code generation) consume far more tokens than plain‑text chat.
Two paths forward
- Optimize token usage – fine‑tune prompts, cache results, and prune unnecessary calls.
- Self‑host your own LLMs. This is the route we recommend.
Self‑hosting puts the cost decision back in your hands and breaks the alignment between your AI and the provider’s business interests.
Why self‑hosting makes sense
- Reliability: Own the endpoint; you aren’t subject to provider outages. An industry‑standard compute service can achieve 99.999 % uptime versus the occasional 98 % uptime of cloud LLM APIs.
- Control: Choose model versions, schedule updates, or freeze a model indefinitely.
- Privacy: All prompts and outputs stay inside your perimeter unless you explicitly export them.
- Interpretability: Tools like
TransformerLensorSAEstocan inspect model internals—something cloud‑only APIs never expose. - Customization: Fine‑tune with QLoRA or similar methods to reach SOTA quality on niche tasks with a fraction of the compute cost.
The trade‑offs
Running your own models also means taking on responsibilities that were previously handed off to the provider.
- Supply‑chain security: You must vet model weights for backdoors or malicious code.
- Infrastructure management: Deploying, scaling, and monitoring GPU/CPU resources is non‑trivial.
- Breaking changes: Runtime or model updates can break existing pipelines; you need a version‑pinning strategy.
- Performance limits: Frontier models still deliver the best quality; smaller models may need careful prompt engineering.
- Resource utilisation: Memory‑heavy models can cause OOM errors that cascade to other services.
Choosing the right runtime
n8n’s architecture allows you to swap the inference layer without rewriting workflow logic. Here’s a quick comparison:
| Runtime | CPU | GPU | Best use‑case |
|---|---|---|---|
| Ollama (llama.cpp) | ✔ | Partial | Dev, low‑traffic, quick start |
| vLLM | ✖ | ✔ | High‑concurrency production workloads |
| SGLang | ✖ | ✔ | Structured JSON/tool‑calling scenarios |
| ExLlamaV3 | ✖ | ✔ (VRAM‑constrained) | Large models on limited GPU memory |
| LM Studio | ✔ | Partial | Desktop experimentation (not headless) |
Model selection guide for n8n agents
Most business‑automation workloads hit the sweet spot at 3‑13 B parameters with Q4‑bit quantisation. Below is a shortlist that works well on a single consumer‑grade GPU or a modern CPU server.
- Llama 3.x (8 B‑70 B) – well‑supported, commercial‑friendly licence.
- Qwen 2.5‑Coder (3 B‑9 B) – excellent code generation and multilingual support.
- Mistral Nemo / Mixtral (7 B‑22 B) – efficient mid‑size models for general‑purpose agents.
- Google Gemma 4 (2 B‑4 B) – tiny footprint, Apache‑2.0 licence.
- SmolLM‑3B – strong performance‑to‑size ratio, great for classification and routing.
Getting started with n8n and a self‑hosted LLM
- Provision compute – GPU pods (RunPod, Lambda Labs, CoreWeave) or CPU instances on your favourite hyperscaler.
- Deploy a runtime (Ollama for quick iteration; switch to vLLM when you need high throughput).
- Pull the desired model from HuggingFace or the official model hub.
- Configure the n8n
LLM Routernode to point athttp://localhost:11434/v1(or your custom endpoint). - Build workflows that cache expensive calls, use
Tool‑Callingnodes for structured output, and enable graceful fallback if the endpoint is unreachable. - Monitor resource usage with Prometheus/Grafana and set alerts for GPU memory or latency spikes.
Conclusion
As token economics shift toward market‑rate pricing, the safest way to keep AI spend predictable is to own the model stack. n8n’s plug‑and‑play architecture makes the transition painless: you can start with a single‑GPU Ollama test, then scale to a robust vLLM cluster without touching the workflow logic. The trade‑offs are real—security, ops, and maintenance overhead increase—but the gains in cost control, privacy, and customisation are compelling for any organisation that relies on LLM‑driven automation.
By taking the reins on the inference layer, you make sure that your AI agenda stays aligned with your business goals, not the whims of a cloud provider.