// practical guide · 2026-09-28
Self-hosting a 30B-class coding model: hardware, cost, and when not to bother.
You want to run a serious coding model locally. No vendor lock-in, full control, your data stays yours. But 30B parameters require specific hardware, and the math is not always in your favor. Here is the real VRAM budget, the GPU options that work, and the rough cost crossover where self-hosting can become cheaper than paying per token.
// the short version
- VRAM math is inflexible: a 30B model at full precision needs ~120 GB. Quantization cuts this to 18–24 GB, but introduces quality tradeoffs.
- A single 24 GB card (RTX 4090) runs a 4-bit-quantized 30B model; 5-bit is a tight fit with little room for context. Dual-GPU setups mostly add complexity.
- Throughput is roughly 25–40 tokens/sec for a dense 30B at 4-bit on a 24 GB card, depending on settings. Fine for interactive work, and it never queues behind another tenant.
- The rough crossover is around 14M tokens per month on these assumptions, not the hundreds of thousands most guides claim. Below that, hosted APIs are cheaper.
- Long-context work does not lower the crossover — input tokens are the cheapest tokens to buy. What it changes is the absolute size of the monthly bill.
VRAM math for a 30B model at different quantizations
A 30B parameter model at full precision (FP32) requires 4 bytes per parameter. That is 120 GB of VRAM. Nobody has that in a single consumer GPU. So you quantize.
| Quantization | VRAM per Model | Quality vs. FP32 | Fit in Consumer GPU? |
|---|---|---|---|
| FP32 (no quantization) | 120 GB | 100% (reference) | ❌ No |
| FP16 (half-precision) | 60 GB | ~98% | ❌ No (needs 48 GB+ of VRAM) |
| Q8 (8-bit quantization) | 30 GB | ~95% | ❌ Barely (tight fit) |
| Q5 (5-bit quantization) | 24 GB | ~90–93% | Tight (little room for context) |
| Q4 (4-bit quantization) | 18 GB | ~85–90% | ✓ Yes (room for context) |
On a single 24 GB card, Q4 is the practical choice because it leaves room for the context window. Q5 gives slightly better quality but leaves little room for context. Quality percentages here are rough rules of thumb, not measurements, and lower-bit quants can degrade on long reasoning tasks.
GPU options: single card vs. dual-GPU setups
Single GPU (recommended for 30B):
- • RTX 4090 (24 GB): Consumer gold standard. $1600–1900 used, ~450W TDP. Runs a Q4 30B with room for context. Zero configuration complexity.
- • RTX 6000 Ada (48 GB): Professional card, overkill for 30B but future-proof. $8000–12000 new, only relevant if you also need CUDA for other work.
- • A6000 (48 GB): Older pro card, $4000–6000 used. Slower than RTX 4090 per-token but never maxes out VRAM.
Dual GPU (not recommended for 30B, but comes up):
- • Two RTX 4090s give 48 GB, enough for 8-bit but not for FP16 (about 60 GB). $3200+ in hardware, plus PCIe bandwidth losses (the 4090 has no NVLink). Adds complexity for minimal speedup on most inference tasks.
- • Only worth it if: You are doing batch inference (10+ requests at once), you need FP16 quality, or you have other high-VRAM workloads (training, large datasets).
Inference server choices and their tradeoffs
You need software to actually run the model. Options:
- •llama.cpp: Pure C++, multi-threaded on CPU with full CUDA offload for GPU work, and the easiest to set up. Optimized for low-latency single-stream inference on consumer hardware. Batching and dynamic scheduling are thinner than vLLM's, but for single-user work this is the standard. Throughput: roughly 25–40 tokens/sec on a 24 GB RTX 4090 for a dense 30B at Q4 — a mixture-of-experts model of the same total size runs several times faster, since only the active experts are read per token.
- •vLLM: Optimized for high throughput (batch requests). Better for multi-user setups or API services. Overhead is higher, so single requests are slightly slower. Use this if you are serving requests from multiple processes or external clients.
- •Ollama: Wrapper around llama.cpp with a nice CLI. Simpler than raw llama.cpp for beginners, but sacrifices some control and transparency.
Recommendation for 30B: Use llama.cpp or Ollama if you are a solo user. Use vLLM if you are serving an API or have multiple concurrent requests.
The real cost crossover: self-hosting vs. cloud APIs
Example cloud API pricing (per 1M tokens; check current rates):
- • Example mid-tier frontier model: ~$3 input / $15 output
- • Example older premium model: ~$10 input / $30 output
- • Hosted flat-rate plans (ours included): priced per month, not per token
Self-hosting cost (amortized over 3 years):
# # Single RTX 4090 setup, amortized over 3 years (rough): GPU hardware: $1800 Power (~300W avg, $0.12/kWh, 24/7): ~$315/year × 3 = $945 Total over 3 years: ~$2745 (~$76/month) # # Cost per 1M tokens, by how hard you actually push the card: 500M tokens over 3 years: ~$5.50 per 1M 1B tokens over 3 years: ~$2.75 per 1M # # Marginal cost once the card is paid for (electricity only): ~$0.33 per 1M tokens at 30 tok/s
Breakeven: derive it from the monthly fixed cost rather than from a token count someone else guessed. The card runs ~$76/month all-in. A coding-agent workload is input-heavy — a lot of context in, modest diffs out — so at the example pricing above a realistic 80/20 input-to-output mix blends to about $5.40 per 1M tokens. That puts breakeven near 14M tokens per month: closer to 5M if your work is output-heavy, closer to 25M if it is almost entirely input context. Below that line the hosted API is cheaper. Above it the gap widens quickly, because your marginal cost is electricity and theirs is list price.
Note what that threshold is not. It is not 50K tokens a month, and it is not 500K. Those figures circulate widely and they are off by one to two orders of magnitude, because they amortize the hardware against a token volume no single developer actually generates. Ten-plus million tokens a month is a genuinely heavy agent user — many full-codebase passes a day, every working day.
Self-hosting does not beat a flat monthly plan on price. At ~$76/month for the card alone it loses to a $20/month hosted plan, and it will keep losing. You self-host for control, privacy, and the absence of rate limits. Treat the cost case as something that only shows up at serious volume.
Long-context work: bigger bills, not an earlier breakeven
Cloud APIs charge by token, so a 50K–200K token input (an entire codebase, a long document) is cheap per request and expensive per month. The per-request number is almost reassuring; it is the volume that gets you:
# # Cloud API cost for one 100K-token request: Example $3/M-input model: 100K × $3/M = $0.30 (input only) Cheap once. 100/month = $30. 1000/month = $300. # # # Self-hosted, same request. Fixed cost $50/month ($1800 GPU / 36 months): Electricity per request: under $0.01 (negligible) At 100 requests/month: ~$0.50 each -> cloud still cheaper At 170 requests/month: ~$0.30 each -> breakeven At 1000 requests/month: ~$0.05 each -> roughly 6x cheaper
Read that table carefully, because it says the opposite of what most self-hosting guides claim. Long-context work does not make the GPU pay off sooner. Input tokens are the cheapest tokens to buy, so measured per token the breakeven sits higher, not lower — around 170 of these requests a month before the card wins. What long-context work really changes is the absolute number: $300/month is a line item someone will ask about, and that is the volume at which owning the hardware starts to look like a decision rather than a hobby. The structural argument is stronger than the arithmetic one — no context ceiling, no per-request premium, and no provider deciding your long-context pass is abuse.
When self-hosting is the wrong call
Self-hosting is not free and is not always the right answer. Skip it if:
- → You use the model under 2 hours per week. The electricity cost + hardware amortization will exceed any API savings.
- → You need maximum quality and do not want quantization. A quantized 30B model is good for many tasks, but if you specifically need FP16 or FP32 quality, you need $8K+ in hardware.
- → You have inconsistent usage patterns. If you use the model heavily one month and barely at all the next, the amortized cost looks worse. Cloud APIs match actual usage automatically.
- → You share compute with other people who have different GPU needs. Sharing a GPU between inference and training, or between different model sizes, adds complexity and risk.
// or compare first
Not sure if self-hosting is for you? Compare a hosted uncensored agent.
No hardware to buy. No power costs to calculate. A hosted uncensored coding agent, so you can see whether the workflow fits before you commit to GPU ownership. Plans start at $20/mo.
See plans →