Open-Source LLM Costs — Self-Hosting vs API vs Inference Providers
Open-weight models like Llama, Mistral, and Qwen are free to download but not free to run. This guide breaks down the real costs of self-hosting, compares them to API pricing, and identifies the break-even points.
The three ways to run open-source models
Option 1: Self-host on rented GPUs (RunPod, Vast.ai, Lambda). You control everything and pay per-hour for compute. Option 2: Use an inference provider (Together AI, Fireworks, Groq) that hosts the model for you at per-token pricing. Option 3: Self-host on your own hardware. Each option has different cost structures, and the cheapest depends on your volume, latency requirements, and team expertise.
Inference provider pricing
Together AI, Fireworks, and Groq host popular open models at competitive per-token rates. Llama 3.3 70B costs $0.23–$0.59/M input depending on provider. Llama 3.1 8B costs $0.05–$0.10/M. Mixtral 8×7B costs $0.24/M. These are the simplest option: no infrastructure to manage, scale instantly, and pay only for what you use. For workloads under 10M tokens/day, inference providers are almost always the most cost-effective choice.
Self-hosting cost breakdown
Running Llama 3.3 70B requires approximately 140GB of VRAM in FP16 (2× A100 80GB or 1× H100). On RunPod, an H100 costs roughly $2.50/hour or $1,800/month. This H100 can serve approximately 20–30 requests/second for a 70B model. At 30 req/sec with average 1K tokens/request, that's 77.8B tokens/month at a cost of $0.023/M tokens. Compare to Together AI at $0.23/M — self-hosting is 10× cheaper at full utilization. But at 10% utilization (3 req/sec), your effective cost is $0.23/M — the same as the API.
The break-even calculation
Self-hosting breaks even when: (monthly GPU rental) < (monthly token volume × API price per token). For Llama 70B on an H100 ($1,800/month) vs Together AI ($0.23/M): break-even is at 7.8M tokens/day. Below that, use the API. Above that, self-host. For smaller models like Llama 8B on an A10G ($440/month) vs API ($0.05/M): break-even is at 293M tokens/day — the API is almost always cheaper for small models because the per-token rate is already so low.
Hidden costs of self-hosting
GPU rental is only part of the cost. Add: engineering time to set up and maintain vLLM/TGI (2–5 days initially, 2–4 hours/month ongoing), monitoring and alerting infrastructure, handling GPU failures and provider outages, model updates and quantization tuning, and load balancing for multi-GPU deployments. Realistically, add 30–50% to the raw GPU cost for operational overhead. A team that has never managed ML infrastructure should budget 2–3× the GPU cost for the first three months.
Recommended approach by scale
Under 1M tokens/day: use an inference provider API. No infrastructure overhead, pay-per-use. 1–10M tokens/day: still use an API unless you need custom model configurations (specific quantization, LoRA adapters, custom stopping criteria). 10–100M tokens/day: evaluate self-hosting. Run a two-week pilot on rented GPUs, measure actual throughput and utilization, then decide. Over 100M tokens/day: self-hosting on reserved or owned GPUs is likely 5–10× cheaper than any API. At this scale, the infrastructure overhead is justified.
Related calculators
Related guides
Frequently Asked Questions
Which open-source model offers the best value?
For most tasks: Llama 3.3 70B via inference providers at $0.23–$0.59/M. It matches GPT-4o quality on many benchmarks at 5–10× lower cost. For budget workloads: Llama 3.1 8B at $0.05/M — capable enough for classification, extraction, and simple generation. For code: Qwen 2.5 Coder 32B at $0.20/M offers strong coding performance. For reasoning: DeepSeek R1 distilled variants offer reasoning capabilities at $0.15–$0.88/M.
Can I fine-tune open-source models?
Yes — this is their biggest advantage over proprietary APIs. You can fine-tune Llama, Mistral, or Qwen on your own data using tools like Axolotl, Unsloth, or Hugging Face TRL. Fine-tuning a 7B model costs roughly $5–$20 on an A100 for a typical dataset. Fine-tuning a 70B model costs $50–$200. The fine-tuned model runs at the same inference cost as the base model with no per-token markup.
Is Groq really faster than OpenAI?
Yes, for supported models. Groq runs on custom LPU hardware that delivers 300–800 tokens/second output speed for models like Llama 3.3 70B — roughly 3–5× faster than typical GPU inference. The trade-off: limited model selection (mostly Llama and Mixtral variants) and potentially higher per-token pricing than GPU-based providers. Groq is ideal for latency-sensitive workloads where response speed directly impacts user experience.
Which inference provider is cheapest for Llama models?
Prices fluctuate, but as of late 2026: Together AI ($0.18–$0.59/M for Llama 4), Fireworks ($0.20–$0.60/M), Groq ($0.27–$0.70/M, but fastest latency). DeepInfra and Lepton AI are also competitive at $0.15–$0.50/M. Prices change frequently as providers compete — check current rates on each provider's pricing page. For cost-sensitive production use, run a monthly price comparison across providers and route to the cheapest one automatically.
Is the license for open-source models truly free for commercial use?
It depends on the model. Apache 2.0 licenses (Mistral, Qwen, DeepSeek): fully free for commercial use with no restrictions. Meta Llama license: free for commercial use if your product has <700M monthly active users; above that, you need a separate license from Meta. RAIL licenses (some older models): may restrict certain use cases. Always read the specific license before deploying in production. "Open-weight" is not synonymous with "unrestricted."
How do I evaluate if an open-source model is good enough for my use case?
Run your production eval suite (50–200 test cases) on the open-source model and compare to your current proprietary model. Focus on: (1) accuracy on your specific task (not generic benchmarks). (2) Format compliance (does it follow your output schema?). (3) Edge case handling. (4) Latency at your expected throughput. If the open-source model scores within 5% of the proprietary model on your eval, the 3–10× cost savings is usually worth it.
What about data privacy with open-source models?
Self-hosted open-source models offer the strongest data privacy: data never leaves your infrastructure. No third-party sees your prompts, no data retention policies to worry about, no risk of training on your data. Inference providers vary: most state they do not train on API data, but data passes through their servers. For highly sensitive workloads (medical records, legal documents, financial data), self-hosting open-source models is the most privacy-preserving option available.
Guide updated 2026-11-18. Pricing data verified weekly. See methodology · sources.