12 Techniques to Cut AI Inference Costs
FinOps LLM Engineering Production AI 2026 Playbook

12 Techniques to Cut
AI Inference Costs

The complete engineering playbook for teams overpaying on token spend

LLM inference is now a variable line in gross margin — and most production teams are overpaying by 50–90% before any optimisation. This guide covers every proven lever, in the order you should pull them, with the numbers you need to make the business case.

August 2026 · 20 min read · AI FinOps & Inference Engineering
The Problem — and Why It Compounds

AI inference looks cheap in prototypes and catastrophically expensive in production. The gap exists because prototypes don’t encounter long prompts, long outputs, low GPU utilisation, retry storms, or multi-call agent workflows — all of which scale with production traffic. A realistic stacked optimisation for a production AI agent — quantization, continuous batching, prompt caching, context compaction, and model routing — typically achieves a 50–100× cost reduction compared to naive deployment.

The sequencing matters as much as the techniques themselves. Most teams reach for quantization or routing first because those feel like the “engineering” levers — but prompt caching on a high-reuse workload returns more savings in the first week than months of routing infrastructure work for most workloads. Enable the trivial wins before building the complex ones. This playbook is ordered by implementation cost vs. expected return, so you can start generating savings in hours rather than weeks.

90%
Savings on cache-hit tokens with prompt caching at near-zero implementation cost
DigitalApplied FinOps 2026
50%
Guaranteed discount on batch API calls (Anthropic, OpenAI) for non-urgent pipelines
Batch API pricing, 2026
98%
Cost reduction demonstrated by Stanford’s FrugalGPT LLM cascade routing research
Stanford FrugalGPT
280×
Cost drop for GPT-3.5-level inference between Nov 2022 and Oct 2024
Stanford HAI 2025 AI Index
Recommended Implementation Order — Highest ROI first
01 Measure first
02 Prompt Cache
03 Batch non-urgent
04 Cap outputs
05 Right-size models
06 Audit context
07 Quantize self-hosted
08 Fine-tune / Hybrid

“Cost-per-token is not the metric that aligns engineering decisions to business outcomes. The correct unit is cost-per-successful-outcome — and optimising for it changes which levers you pull first.”

— FinOps Foundation State of FinOps 2026 Report
01
Model Right-Sizing & Intelligent Routing
Route simple tasks cheaply; reserve frontier models for hard reasoning
40–98%
Cost reduction

The single highest-impact structural decision in any AI system is which model handles which query. Frontier models like GPT-4o and Claude Opus are priced at $5–15 per million tokens — 10–50× more expensive than capable mid-tier models like GPT-4o mini or Claude Haiku at $0.15–1 per million tokens. Routing every query to the frontier is the most expensive default in AI engineering.

Intelligent routing inserts a task classifier before the model selection step. Simple queries — intent classification, summarisation, extraction — route to a cheap fast model. Only queries requiring deep reasoning, multi-step planning, or domain synthesis route to the frontier model. Stanford’s FrugalGPT research demonstrated up to 98% cost reduction using LLM cascade routing with no quality degradation, making this the highest-ceiling single technique in the stack.

Implementation options range from simple (a hardcoded rule: queries under 200 tokens route to the small model) to sophisticated (a trained routing classifier that scores queries on complexity, domain specificity, and required reasoning depth). Tools like PortKey AI, LiteLLM, and OpenRouter provide model routing infrastructure out of the box.

Query
Classifier
↓ Simple
Small Model
Output
↓ Hard
Frontier
Output
Cost Save
95%
Effort
Med
Risk
Low
02
Prompt Caching
Reuse repeated context — stop burning tokens on identical prefixes
90%
On cache-hit tokens

Prompt caching is the quickest, highest-return optimisation for the majority of production workloads. Both Anthropic and OpenAI provide automatic prefix caching: when a prompt shares a long prefix with a previously processed prompt — a system prompt, a set of instructions, a document — the provider reuses the cached KV computation instead of reprocessing the prefix from scratch. Cache hits are priced at 90% discount (Anthropic) or treated as free (OpenAI).

Implementation for managed APIs requires only proper prompt structure: place the stable, shared content (system prompt, document context, few-shot examples) at the top of the prompt where caching operates, and the dynamic, query-specific content at the bottom. For self-hosted models, prefix caching in vLLM achieves 30–50% compute reduction at high request volumes with shared prefixes, and KV-cache-aware routing (as in the llm-d project) directs requests to the node holding the relevant cache to avoid redundant computation.

Google’s TurboQuant (March 2026) compresses the KV cache itself to 3 bits per value with zero measured accuracy loss, achieving 6× memory reduction — enabling dramatically more aggressive caching on the same hardware.

Prompt
Cache Check
↓ Hit
Cached KV
90% cheaper
↓ Miss
Full Process
Store Cache
Cost Save
90%
Effort
Low
Risk
None
03
Output Length Limits
Cap generation length — prevent silent token overspend
20–60%
Output token saving

LLMs default to generating as many tokens as they deem necessary. Without explicit constraints, models over-generate on nearly every task — adding preambles (“Great question!”), unnecessary caveats, redundant explanations, and verbose summaries when concise answers are needed. Output tokens are typically priced 3–5× higher than input tokens, so unconstrained generation directly inflates the per-request cost.

The max_tokens parameter is the first lever. Set it as low as the task can tolerate: a classification task needs 5–10 tokens, not 500. A structured JSON output needs a schema-defined ceiling. A summary needs a word count limit enforced in the system prompt (“respond in under 150 words”). Add explicit prompt instructions: “Be concise. Answer directly without preamble.”

For structured outputs, using JSON schema or function calling constrains the output to exactly the fields requested, preventing the model from appending explanatory text after the structured response. Monitor output token distributions per endpoint — a p95 that is 5× the p50 is a reliable signal of inconsistent generation that a tighter max_tokens policy and clearer prompt instructions can resolve.

Request
max_tokens Policy
Controlled Gen.
Shorter Output
Lower Cost
Cost Save
55%
Effort
Low
Risk
Test
04
Batching Requests
Move slow workloads into batches for instant cost reduction
50%
Batch API guaranteed

Both Anthropic’s Batch API and OpenAI’s Batch API offer a guaranteed 50% discount for asynchronous batch processing — the easiest and most guaranteed cost reduction in the managed API space. Batching aggregates multiple requests and processes them together during off-peak periods, trading latency (24-hour completion window) for a flat cost halving. No quality change, no model change — just a different API endpoint.

On self-hosted infrastructure, continuous batching in vLLM and TensorRT-LLM dramatically improves GPU utilisation by dynamically grouping requests rather than processing them one-at-a-time. High-QPS background jobs achieve 3–5× cost reduction versus one-at-a-time; interactive chat with continuous batching achieves 1.5–2.5× at acceptable latency; strict real-time sub-100ms requests see a 1.2–1.5× ceiling before latency breaks.

Identify which workloads in your system are genuinely latency-tolerant: nightly report generation, document classification pipelines, embedding generation for vector indexing, offline fine-tuning data preparation, and batch evaluation runs. These can all move to batch processing with zero user-facing impact.

Non-urgent jobs
Batch Queue
Batch API
Delayed Process
50% cheaper output
Cost Save
50%
Effort
Low
Risk
None
05
Async Inference
Run tolerant workloads asynchronously to smooth peaks and cut retries
30–40%
Via peak smoothing

Synchronous inference requires the server to maintain a connection and hold capacity for the full duration of generation — driving peak capacity costs even during low-demand periods. Async inference decouples request submission from result retrieval: a task is submitted to a queue, a worker picks it up when capacity is available, and the result is delivered via webhook or polling. This dramatically smooths demand peaks and eliminates the over-provisioning needed to handle burst traffic synchronously.

The practical impact: fewer timeouts, fewer retries (each retry is a full duplicate cost), and the ability to right-size infrastructure for average load rather than peak load. Retry storms — where a wave of timeouts triggers a cascade of retries that amplifies load further — are one of the most common sources of unexpected cost spikes in production LLM systems. Async queuing eliminates this failure mode entirely for tolerant workloads.

Implement with a message queue (Redis, SQS, RabbitMQ) between your API layer and the inference workers. Include idempotency keys to prevent duplicate processing of retried submissions, and set appropriate queue depth limits to prevent the queue from growing unboundedly during outages.

Task submitted
Queue
Worker picks up
Process Later
Result notification
Cost Save
38%
Effort
Med
Risk
Low
06
Quantization
Reduce precision carefully to slash memory and hosting cost
50%
GPU infrastructure

Quantization converts model weights from high-precision formats (FP32, FP16) to lower-precision formats (INT8, INT4, FP8), shrinking model size, reducing VRAM requirements, and enabling the same model to run on fewer — or smaller — GPUs. A 70B parameter model in FP16 requires ~140 GB VRAM. In FP8 it needs ~70 GB, fitting on a single H100 (80 GB) instead of requiring two GPUs. In INT4 it drops to ~35 GB. On GMI Cloud, serving a 70B model on 1× H100 at ~$2.10/GPU-hour versus 2× H100 at ~$4.20/GPU-hour cuts your GPU bill in half.

Quantizing from FP16 to INT8 or INT4 reduces memory by 2–4× and cuts inference cost by roughly 50% while maintaining 95–99% of original accuracy. FP8 quantization on H100/H200 hardware with TensorRT-LLM delivers 1.5–2× throughput improvement over FP16 with minimal quality degradation for most LLM tasks. The golden rule: always test output quality at your target precision before deploying to production, particularly for tasks requiring precise arithmetic or low-frequency vocabulary.

For managed API users, quantization is handled by your provider — but model selection effectively encodes a quantization decision. Providers like Together AI and Fireworks serve quantized variants of open models at dramatically lower prices. The optimal compression pipeline for self-hosted models is P-KD-Q: prune first, distill second, quantize last — each step compounds the savings.

FP16 Model
INT8/INT4 Convert
Less VRAM
Fewer GPUs
Cheaper inference
Cost Save
70%
Effort
Med
Risk
Test
💡

The stacking principle — where real savings come from

No single technique achieves 50–100× savings. The compounding effect does. A realistic stacked optimisation — quantization + continuous batching + prompt caching + context compaction + model routing — typically achieves 50–100× cost reduction compared to naive deployment. Implement techniques in order of effort-to-return ratio. Caching and batching first; quantization and fine-tuning last.

07
Fine-Tuning vs. Prompting
Train smaller task-specific models to replace long expensive prompts
60–80%
vs long prompts

Few-shot prompting with 10–20 examples is a common technique for steering model behaviour without fine-tuning. But each example adds hundreds to thousands of tokens per request — and at scale, those tokens compound. Fine-tuning bakes those examples into model weights, allowing you to serve the same behaviour with a much shorter prompt (often under 100 tokens), or to use a significantly smaller model that matches the larger model’s quality on your specific task.

The break-even analysis is straightforward: compare (fine-tuning cost + smaller model inference cost) against (larger model inference cost × request volume). For high-volume workloads — tens of thousands of daily requests — fine-tuning typically breaks even within 2–4 weeks and delivers 60–80% ongoing cost reduction. For low-volume workloads, prompting remains more economical.

The 2026 standard approach is PEFT (Parameter-Efficient Fine-Tuning) via LoRA or QLoRA adapters — fine-tuning only a small fraction of model parameters at a fraction of the compute cost of full fine-tuning. A LoRA-adapted Llama 3 8B can match GPT-4-level accuracy on a narrow, well-defined enterprise task, served at 1/50th of the API cost.

Task Data
Fine-Tune Small Model
Short Prompt
Inference
Lower cost per call
Cost Save
75%
Effort
High
Risk
Test
08
Context Window Auditing
Send only useful context — not every prior conversation turn
40–70%
Input token reduction

Chat applications that naively pass the full conversation history on every turn are one of the most common sources of runaway token spend. A 20-turn conversation with 500 tokens per turn accumulates 10,000 input tokens — most of which are not relevant to answering the current question. Auditing and compressing context is a direct, high-impact input token reduction strategy.

The practical toolkit: sliding window (keep only the last N turns); summarisation (compress older turns into a rolling summary using a cheap model); selective retrieval (retrieve only the conversation turns semantically relevant to the current query); and compaction (Anthropic’s built-in context compaction, introduced in 2025, which automatically summarises the oldest portion of the context when approaching the window limit). Combine summarisation with retrieval for maximum compression without quality loss.

For RAG pipelines, context auditing means sending only the top-K most relevant retrieved chunks — not the full retrieved set — and keeping chunk sizes tight enough to be useful without padding the context with surrounding irrelevant text. A retriever that returns 20 chunks when 3 would suffice is adding 17 chunks of unnecessary input tokens to every request.

Long history
Summarize old turns
Retrieve relevant
Short prompt
Cheaper request
Cost Save
65%
Effort
Med
Risk
Low
09
Streaming Responses
Better perceived speed reduces retries and duplicate requests
15–25%
Retry reduction

Streaming doesn’t reduce the token count for a given request — it changes when tokens arrive. By delivering tokens to the user as they are generated (server-sent events), the perceived latency drops dramatically even though total generation time stays the same. The cost impact comes from the downstream effect: users who see immediate token delivery are far less likely to refresh, retry, or abandon and resubmit a request.

In high-traffic production systems, retry-driven duplicate requests can account for 15–25% of total token spend. A user whose synchronous request times out at 15 seconds and retries generates 2× the token cost for 1 result. The same user receiving a streaming response that shows the first token within 200ms (TTFT — time to first token) will almost never retry. Streaming is therefore a cost optimisation as much as a UX improvement.

Additionally, streaming enables early termination: if a user finds the partial response sufficient before generation completes, you can stop generation and avoid billing for the remaining tokens. This is particularly effective for open-ended generation tasks where users often want just enough — not everything the model was going to produce.

Request
Stream tokens
Fast perceived response
Fewer retries
Lower cost
Cost Save
22%
Effort
Low
Risk
None
10
Rate Limiting High-Cost Users
Set budgets and throttles — prevent runaway spend from power users
20–40%
On tail-user spend

In virtually every multi-user AI deployment, a small percentage of users accounts for a disproportionate share of token spend. The top 5% of users by consumption commonly generate 30–50% of total token cost. Without rate limits or per-user budgets, a single heavy user — or an automated process running out of control — can trigger cost spikes that account for a month’s expected spend in a single day.

The solution is a token budget enforcement layer — an AI gateway or middleware component that tracks token consumption per user, team, or feature, and applies throttling or hard limits when budgets are approached or exceeded. This is distinct from the provider-level rate limits (which protect the provider’s infrastructure) — this is your application-level spending control.

Implement with soft limits (warning at 80% of daily budget, suggest more concise prompts) and hard limits (throttle at 100%, return a graceful “quota reached” message). For enterprise deployments, attribute spend by team, product feature, and use case — this gives engineering and finance teams the visibility to make smart allocation decisions rather than cutting costs blindly. The FinOps Foundation State of FinOps 2026 Report found that mature FinOps practices achieve 20–30% cloud cost reductions without performance degradation, but only 42% of teams implement these practices consistently.

User request
Budget check
↓ Under
Allow
Process
↓ Over
Throttle
Controlled spend
Cost Save
35%
Effort
Med
Risk
Low
11
Monitoring & Cost Attribution
Measure spending precisely before deciding where to optimise
20–30%
From visibility alone

You cannot optimise what you cannot measure. Monitoring and cost attribution are not themselves a cost reduction technique — they are the prerequisite for every other technique on this list. Teams that deploy AI without per-feature, per-user, per-endpoint cost attribution routinely over-invest in the wrong optimisations and miss the highest-impact ones entirely.

The correct unit of measurement is cost per successful outcome — not cost per token, not cost per request. A request that generates 5,000 tokens to answer a simple question that needed 100 is a measurement failure as much as a prompt engineering failure. Track: input tokens by endpoint (p50/p95), output tokens by endpoint, cost per user action, retry rates, cache hit rates, and batch utilisation.

# Minimum viable inference cost tracking
metrics = {
  "input_tokens":  response.usage.input_tokens,
  "output_tokens": response.usage.output_tokens,
  "cache_read":    response.usage.cache_read_input_tokens,
  "model":         response.model,
  "feature":       context.feature_name,
  "user_id":       context.user_id,
  "cost_usd":      calculate_cost(response.usage, response.model)
}

Attribute costs by product feature, team, and user segment. This visibility alone typically reveals 2–3 features responsible for 60%+ of spend, a small set of users generating disproportionate cost, and optimisation opportunities that were invisible without the data.

Query
Usage Tracking
Attribute by feature/user
Identify waste
Optimise
Cost Save
25%
Effort
Med
Risk
None
12
Hybrid On-Prem / Cloud Routing
Route cheap traffic locally — send only the hard queries to cloud
50–80%
On routed traffic

Cloud frontier model APIs are priced for capability. For queries that don’t require that capability, you’re paying a premium for nothing. Hybrid routing sends simple, high-volume, low-sensitivity queries to locally-hosted open-weight models (Llama 3, Mistral, Qwen, Phi-4) — which have effectively zero marginal cost once the GPU is provisioned — and reserves cloud API calls for complex queries that genuinely require frontier capabilities.

The economics work at meaningful scale: at 10,000 daily requests where 70% are classifiable as simple, routing those 7,000 to a local model at near-zero marginal cost versus a frontier API at $0.50/1M tokens ($3.50/day saved) vs $5/1M tokens ($35/day saved) creates substantial sustained savings. The break-even on GPU provisioning depends on utilisation rates and the cost of on-prem or reserved cloud GPU capacity.

Tools like LiteLLM, PortKey, and OpenRouter implement hybrid routing natively — routing rules can be configured without custom code. Privacy and data sovereignty are additional motivations beyond cost: sensitive data that cannot leave the enterprise perimeter must route to on-prem models regardless of query complexity, making hybrid routing a compliance architecture as much as a cost architecture.

Query
Router
↓ Simple
Local Model
~$0 marginal
↓ Complex
Cloud Model
Full quality
Cost Save
72%
Effort
High
Risk
Test

Quick Reference

All 12 Techniques at a Glance

# Technique Max Saving Effort Quality Risk Best Applied When
02 Prompt Caching 90% (cache hits) Very Low None Repeated system prompts, RAG pipelines, chat apps
04 Batching Requests 50% guaranteed Very Low None Nightly pipelines, embeddings, offline classification
01 Model Right-Sizing 40–98% Medium Test routing logic Mixed-complexity query traffic at meaningful volume
03 Output Length Limits 20–60% Low Test per use case Any endpoint with unconstrained generation
08 Context Window Auditing 40–70% Medium Low Long chat sessions, multi-turn agents, RAG pipelines
06 Quantization 50–70% Medium Test target precision Self-hosted deployments, private cloud, on-prem
12 Hybrid On-Prem/Cloud 50–80% High Test routing High volume + data sovereignty or privacy requirements
07 Fine-Tuning 60–80% High Eval required High-volume narrow tasks with stable data distribution
10 Rate Limiting 20–40% Medium None Multi-user deployments with power user concentration
05 Async Inference 30–40% Medium None Any latency-tolerant background processing workflow
09 Streaming Responses 15–25% Low None Interactive user-facing applications with retry risk
11 Monitoring & Attribution 20–30% Medium None Always — prerequisite for every other technique

The 3-hour quick-win sequence

Hour 1: Add usage logging with cost attribution per feature and user. Hour 2: Enable prompt caching by restructuring your system prompts — place all stable content at the top. Hour 3: Identify your largest latency-tolerant pipeline and migrate it to the Batch API. These three changes typically deliver 30–60% cost reduction in the first week with near-zero quality risk and no architectural change.

Cost Optimisation Is an Engineering Discipline, Not a One-Time Project

AI inference costs compound exactly like technical debt — ignored optimisations become increasingly expensive as traffic scales. The teams that establish cost monitoring, caching, and routing infrastructure early build a compounding advantage: each additional technique applied to a well-instrumented system delivers measurable, attributable savings. Teams that deploy without this infrastructure are guessing.

The correct sequence matters: measure first, apply the trivial wins (caching, batching, output caps) immediately, then invest in the architectural changes (model routing, fine-tuning, hybrid infrastructure) that require meaningful engineering effort. Following this order ensures that every hour of engineering effort is directed at the highest remaining opportunity, not the most technically interesting one.

The hardware cost curve continues downward — Stanford HAI reports that inference costs at GPT-3.5 level dropped 280× between November 2022 and October 2024, with hardware costs declining 30% annually. But optimisation still matters: the teams running 10M daily requests who implement this playbook are saving millions annually. The math does not stop working because the underlying cost is falling.

The goal is not the cheapest inference. It is the cheapest inference that still delivers the outcome users need. Measure for outcomes. Optimise from there.