The LLM Inference Cost Optimization Playbook
LLM inference cost optimization has a clear order of operations, and skipping ahead to exotic techniques before the basics wastes engineering time. The sequence that produces the biggest wins fastest: right-size the model for the task, quantize it, tune batching and concurrency settings against real traffic, exploit prefix caching, and only then evaluate speculative decoding or multi-model routing. Combined, these levers routinely cut inference cost per million tokens by 60 to 85 percent versus a naive unoptimized deployment, before even comparing self-hosted against API pricing. This playbook walks the order that matters and the on-prem versus API breakeven math for 2026 hardware and API pricing.
Step One: Right-Size the Model Before Optimizing Serving
The single biggest cost lever is using a smaller model that meets the task's actual quality bar, and it is the step most teams skip because a large frontier-class model is the safe default choice during prototyping. A 7B to 14B class model handling classification, extraction, or structured summarization at production scale, quantized and well-served, can cost an order of magnitude less per token than routing the same task to a 70B or larger model, often with no measurable quality difference on the specific task once you have evaluated it properly. Build a task-specific eval set, test model size down from your current default, and only pay for a bigger model where the eval set proves you need it. This single step frequently dwarfs every serving optimization combined.
- Build a task-specific eval set before assuming you need your current model size
- Test smaller models (7B-14B class) against the eval set for classification, extraction, and structured tasks specifically
- Route by task complexity rather than defaulting every request to your largest deployed model
- Revisit model choice quarterly; the smaller-model quality bar keeps rising as new releases land
Step Two: Quantize and Right-Size Serving Config
FP8 on Hopper or Blackwell hardware, or AWQ on older GPUs, typically cuts memory footprint 50 to 75 percent with minimal quality loss, which directly multiplies how many concurrent requests a given GPU serves and therefore divides cost per token by roughly the same factor. Pair this with the vLLM config tuning covered in our production deployment guide: --gpu-memory-utilization, --max-num-seqs, and --max-model-len set against real traffic, not defaults. Together, quantization and config tuning are usually the highest-leverage, lowest-risk optimization available, since they require no architectural change to your application.
Step Three: Batching, Prefix Caching, and Request Shaping
Continuous batching (on by default in vLLM and SGLang) already captures most of the batching benefit automatically, but concurrency limits still need tuning against your latency SLA. Prefix caching, covered in detail in our KV cache optimization guide, can meaningfully cut compute cost for workloads with shared system prompts or RAG templates, sometimes by 20 to 40 percent on the cache-hit portion of traffic, at zero cost beyond restructuring prompts to put static content first. On the application side, request shaping matters too: capping unnecessary max-token generation limits, using structured output schemas to avoid verbose free-text responses, and batching non-latency-sensitive background jobs into off-peak windows all reduce total token volume without touching the serving stack at all.
- Tune concurrency (--max-num-seqs) against measured latency SLA, not a throughput benchmark alone
- Restructure prompts static-content-first to capture prefix caching savings on repeated system prompts
- Cap max-token generation limits to actual task needs; unconstrained limits silently inflate cost on verbose responses
- Move non-interactive batch jobs (summarization backlogs, embedding regeneration) to off-peak scheduling
On-Prem vs API: The 2026 Breakeven Math
With H100 80GB running roughly $25,000 to $32,000 and comparable cloud GPU rental at $2 to $6 per hour, the breakeven between on-prem ownership and API or cloud-rental usage depends heavily on utilization. At sustained high utilization (a GPU busy more than 40 to 50 percent of the time), owned on-prem hardware typically breaks even against cloud GPU rental within 6 to 12 months, and against commercial API per-token pricing considerably faster for high-volume workloads, since API pricing carries a substantial margin over raw compute cost. At low, bursty utilization, cloud rental or API usage usually wins, since idle owned hardware is pure sunk cost. Run the actual math against your measured or projected token volume and utilization pattern rather than a rule of thumb; the answer flips meaningfully between a 20 percent utilized pilot and an 80 percent utilized production workload.
- H100 80GB: roughly $25k-32k to own; cloud rental roughly $2-6/hr depending on provider and commitment
- High sustained utilization (40-50%+): owned hardware typically breaks even against cloud rental in 6-12 months
- Low, bursty utilization: cloud or API usage usually wins on total cost
- API per-token pricing carries meaningful margin over raw compute; high-volume workloads favor self-hosting faster than the GPU-vs-cloud comparison alone suggests
How Netray Runs Cost Optimization Engagements
Netray works this playbook in order for every on-prem inference engagement: model right-sizing against a client-specific eval set first, then quantization and vLLM config tuning, then prefix caching and request shaping, with speculative decoding evaluated last and only where the concurrency profile supports it. We build the on-prem versus API breakeven model against a client's actual measured token volume and utilization pattern rather than a generic industry rule of thumb, and we have seen the honest answer go either way: some clients are better served staying on API pricing at their current volume, and we say so. The clients who do move to on-prem inference typically see 60 to 85 percent cost-per-token reduction after the full optimization sequence, measured against their pre-optimization baseline.
Frequently Asked Questions
What is the single biggest lever for reducing LLM inference cost?
Right-sizing the model to the task, before any serving-level optimization. Using a well-evaluated 7B to 14B class model for classification, extraction, or structured tasks instead of defaulting to a 70B or larger model can cut cost per token by an order of magnitude with no measurable quality loss on the specific task, once validated against a task-specific eval set. This step is usually skipped during prototyping and is the highest-leverage fix most teams have not made.
When does on-prem GPU ownership beat API pricing for LLM inference?
Roughly when utilization is sustained above 40 to 50 percent, owned hardware (H100 80GB at $25k-32k, or comparable) typically breaks even against cloud GPU rental within 6 to 12 months, and beats commercial API per-token pricing considerably faster for high-volume workloads since API pricing carries meaningful margin over raw compute cost. At low, bursty utilization, cloud rental or API usage usually wins. Run the math against your actual measured token volume rather than a rule of thumb.
How much does quantization typically reduce inference cost?
FP8 on Hopper or Blackwell GPUs, or AWQ 4-bit on older hardware, typically cuts memory footprint 50 to 75 percent with minimal quality loss. Since more concurrent requests fit in the freed memory, this roughly divides cost per token by a similar factor, making it one of the highest-leverage, lowest-risk optimizations available, since it requires no application architecture change, only a serving config update and a quality validation pass.
Key Takeaways
- 1Step One: Right-Size the Model Before Optimizing Serving: The single biggest cost lever is using a smaller model that meets the task's actual quality bar, and it is the step most teams skip because a large frontier-class model is the safe default choice during prototyping. A 7B to 14B class model handling classification, extraction, or structured summarization at production scale, quantized and well-served, can cost an order of magnitude less per token than routing the same task to a 70B or larger model, often with no measurable quality difference on the specific task once you have evaluated it properly.
- 2Step Two: Quantize and Right-Size Serving Config: FP8 on Hopper or Blackwell hardware, or AWQ on older GPUs, typically cuts memory footprint 50 to 75 percent with minimal quality loss, which directly multiplies how many concurrent requests a given GPU serves and therefore divides cost per token by roughly the same factor. Pair this with the vLLM config tuning covered in our production deployment guide: --gpu-memory-utilization, --max-num-seqs, and --max-model-len set against real traffic, not defaults.
- 3Step Three: Batching, Prefix Caching, and Request Shaping: Continuous batching (on by default in vLLM and SGLang) already captures most of the batching benefit automatically, but concurrency limits still need tuning against your latency SLA. Prefix caching, covered in detail in our KV cache optimization guide, can meaningfully cut compute cost for workloads with shared system prompts or RAG templates, sometimes by 20 to 40 percent on the cache-hit portion of traffic, at zero cost beyond restructuring prompts to put static content first.
Put this into numbers
Free interactive tools for exactly this problem. No signup to use them.
LLM Inference Cost Per Million Tokens Calculator
Convert GPU hourly cost, cluster throughput, and real-world utilization into a defensible self-hosted cost per million tokens, exposing what idle GPU time actually costs you.
Free ToolAI Inference Latency Calculator
Estimate decode throughput, time to first token, and end-to-end response time for a self-hosted model from GPU memory bandwidth, parameter count, and quantization.
Free ToolDeepSeek V3 Serving Cost Calculator
Turn DeepSeek V3's GPU footprint and your monthly token volume into an amortized cost per million tokens, so you can compare self-hosting against API pricing on equal terms.
Terms used in this article
Want a cost breakdown comparing your current inference spend against an optimized on-prem deployment? Netray will run the numbers against your real traffic before you commit either way.
Related Resources
LLM Quantization: AWQ vs GPTQ vs FP8 vs GGUF
AWQ, GPTQ, FP8, and GGUF compared for production LLM serving: memory savings, throughput impact, quality loss, and which format fits which deployment.
AI & AutomationvLLM Production Deployment: A Practitioner's Guide
Deploy vLLM in production: continuous batching, PagedAttention, config flags that matter, and the metrics to watch before you trust it with real traffic.
AI & AutomationOn-Prem LLM Inference Hardware in 2026: A Roundup
On-prem LLM inference hardware for 2026: H100 vs H200 vs B200 pricing, when A100 fleets still work, and how to size GPUs against real serving needs.