How to Reduce Your LLM API Costs in 2026 (Without Losing Quality)

Route each task to the cheapest model that passes your quality check, cache the stable prefix of every prompt, batch whatever nobody is waiting on, and trim tokens last. On a workload of 300,000 calls a month (5,000 stable input tokens, 500 variable input tokens and 300 output tokens per call), those steps take Claude Opus 5.5 from $8,400 a month to $37.50 on Claude Haiku 5.5, or to $675 on Claude Sonnet 5.5, at the vendors’ list prices on 2026-10-19. Measure your input to output token ratio first, because it shows which step your bill responds to.
First, run the diagnostic
Pull one week of usage and sum total input tokens and total output tokens. The ratio between them decides which lever pays, and it differs from product to product.
Take Claude Haiku 5.5 at $0.10 input and $0.50 output per million tokens and two workloads. A support team that tags tickets sends about 5,500 tokens in and gets 300 back. A marketing team that drafts copy sends 500 in and gets 2,000 back. Cost per call is tokens times rate: 5,500 input tokens cost $0.00055 and 300 output tokens cost $0.00015, while 500 input tokens cost $0.00005 and 2,000 output tokens cost $0.001.
| Workload | Tokens per call | Input share of bill | Output share |
|---|---|---|---|
| Classification, extraction | 5,500 in, 300 out | 78.6% | 21.4% |
| Content generation | 500 in, 2,000 out | 4.8% | 95.2% |

Same model, same rates, and the dominant side flips. On the classification workload, caching the input prefix is the big win. On the generation workload, input is under 5% of the bill, so caching barely moves it and the savings sit on the output side: a max_tokens cap, a lower reasoning effort, or a cheaper model.
Output is billed at 5x input on every Claude model in Anthropic’s price table, but which side dominates your bill depends on your token ratio, not on the rate card.
The four levers, ranked
On the workload below, model choice saves the most, caching comes second, batching third, and trimming tokens last.
Lever 1: route by task (up to 40x)
This lever is easy to miss, because the model string was written once and never revisited.
Take a pipeline that makes 10,000 calls a day, or 300,000 a month. Each call carries a 5,000 token system prompt (tool definitions and examples), 500 tokens of variable input and a 300 token structured response. That is 1,650 million input tokens and 90 million output tokens a month. On Claude Opus 5.5 the bill is 1,650 x $4 + 90 x $20 = $6,600 + $1,800 = $8,400. The same arithmetic on each model’s list price:
| Model | Rates per 1M tokens (in / out) | Input + output | Monthly cost | vs Opus 5.5 |
|---|---|---|---|---|
| Claude Fable 5.1 | $10 / $50 | $16,500 + $4,500 | $21,000 | 2.5x more |
| Claude Opus 5.5 | $4 / $20 | $6,600 + $1,800 | $8,400 | baseline |
| Claude Sonnet 5.5 | $2 / $10 | $3,300 + $900 | $4,200 | 2.0x cheaper |
| DeepSeek V4.1 Flash, peak | $0.30 / $1.20 | $495 + $108 | $603 | 13.9x cheaper |
| DeepSeek V4.1 Flash, off-peak | $0.15 / $0.60 | $247.50 + $54 | $301.50 | 27.9x cheaper |
| Claude Haiku 5.5 | $0.10 / $0.50 | $165 + $45 | $210 | 40x cheaper |
| GPT-6 Luna | $0.10 / $0.50 | $165 + $45 | $210 | 40x cheaper |


The reason this is safe is that quality saturates on many high-volume tasks. Extraction, classification, formatting and routing have a ceiling that a cheap model already reaches. A frontier model does not extract a date field 40 times better than a cheap one, so the price gap buys headroom the task cannot use.
The rule: cheap models for anything a machine reads, better models for anything a human reads. Route per task, not per app, because a single product usually has both kinds of work in it.
Lever 2: cache your stable prefix (10x to 40x on the cached portion)
Anthropic, OpenAI and DeepSeek each bill a repeated prompt prefix at a discount, and the discount is steep. Per Anthropic’s caching documentation, a cache read costs 0.1x the base input rate on most Claude models, 0.05x on Opus 5.5 and Sonnet 5.5, and 0.025x on Fable 5.1. A 5-minute cache write costs 1.25x base input and a 1-hour write costs 2x. These multipliers stack with the Batch API discount.
The breakeven is short. A write at 1.25x plus one read at 0.1x costs 1.35x, against 2.0x for sending the same content twice uncached. The 5-minute cache is profitable from the first hit. On Opus 5.5 and Sonnet 5.5 the same pair costs 1.30x. The 1-hour cache costs 2x to write, so it pays off at the second hit. The default 5-minute cache refreshes at no extra charge each time it is used, so steady traffic keeps it warm for free.
On the workload above, caching the 5,000 token prefix cuts the monthly input cost on Haiku 5.5 from $165 to $30: 1,500 million prefix tokens at the $0.01 cache-read rate is $15, and 150 million variable tokens at $0.10 is another $15. That is a 5.5x reduction on the input side with no change in quality.
OpenAI and DeepSeek cache too. GPT-6.1 Sol bills a cache read at $0.10 per million against $2.00 uncached, with a 1,024 token minimum and a cache write billed at 1.25x ($2.50). DeepSeek turns context caching on by default for every user and bills a V4.1 Flash cache hit at $0.006 per million at peak against $0.30 for a miss.
Three things break caching, and all of them fail silently.
Your prompt may be too short to cache at all. Each Claude model has a minimum cacheable prefix length:
| Model | Minimum cacheable prompt |
|---|---|
| Claude Fable 5.1, Opus 5.5, Opus 5, Sonnet 5.5, Fable 5, Haiku 5.5 | 512 tokens |
| Claude Opus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5 | 1,024 tokens |
| Claude Opus 4.7 | 2,048 tokens |
| Claude Opus 4.6, Opus 4.5, Haiku 4.5 | 4,096 tokens |
The trap now sits on older models. Haiku 4.5, the model teams kept running because it is cheap and high volume, still has the highest threshold on the list. A 2,000 token system prompt caches on Sonnet 5.5 and Haiku 5.5 and does not cache at all on Haiku 4.5. Anthropic’s docs are explicit that shorter prompts are processed without caching and no error is returned. The minimums apply on every platform where each model is available.
A changing prefix. The cache requires a byte-identical prefix, and cache writes happen only at your breakpoint. One timestamp, session ID or user name at or before that breakpoint means the hash never matches, so you pay for a fresh write on every request and never get a read. Order the prompt static first and dynamic last, and place the breakpoint on the last block that stays identical across requests.
Configuration changes you did not think of as prompt changes. Changing the thinking configuration or the effort setting invalidates cached message blocks, and so does switching between fast and standard speed. Modifying a tool definition invalidates the entire cache. If you tune effort down for cost, expect a cache reset when you do.
The fix for all three is verification, not assumption. Read the usage fields on your responses: if both cache_creation_input_tokens and cache_read_input_tokens come back 0, nothing cached. Total input is the sum of cache_read_input_tokens, cache_creation_input_tokens and input_tokens, so your hit rate is the first of those divided by that sum. Cache hits are also not deducted against your rate limit, so good caching buys headroom as well as savings.
For caching and cached-input cost details, see prompt caching for stable prefixes.
Lever 3: batch anything asynchronous (2x)
Anthropic’s Batch API takes 50% off both input and output, and the discount stacks with prompt caching. Most batches finish within an hour, and a batch that has not completed in 24 hours expires. On Opus 5.5 the batch rates are $2 input and $10 output per million tokens. OpenAI prices GPT-6.1 Sol batches at half of Standard too, $1.00 input and $5.00 output against $2.00 and $10.00.
The qualifying test is simple: is a human waiting on this response right now? If not, batch it. Nightly enrichment, bulk classification, document processing, eval runs and content pipelines all qualify. Run synchronously out of habit, they pay double for latency nobody needed.
Lever 4: trim tokens (marginal)
This is the lever everyone starts with and the smallest one. It is still worth doing, after the other three.
Set max_tokens deliberately rather than defensively. Cut few-shot examples to the minimum that holds quality, since every example bills on every call. Delete accumulated instructions: most production system prompts are scar tissue, one line added per bug, and nobody removes any.
Then check your reasoning settings. Adaptive thinking runs on all four current Claude models, and effort steers how much the model thinks. Default effort is high on Sonnet 5.5 and Fable 5.1 and medium on Opus 5.5 and Haiku 5.5, and thinking tokens count as billed output tokens. Setting effort explicitly on classification-type work trims output without touching the prompt. The full mechanics are in what actually changed on the Sonnet 5 bill.
To review the token unit behind this cost, see what is a token and why it affects API cost.
What it looks like compounded
The levers multiply. On the same 300,000-call workload, each row applies one more step to the model in its column:
| Setup | Opus 5.5 | Sonnet 5.5 | Haiku 5.5 |
|---|---|---|---|
| List price, no caching or batching | $8,400 | $4,200 | $210 |
| Plus cached prefix | $2,700 | $1,350 | $75 |
| Plus batch processing | $1,350 | $675 | $37.50 |

Opus 5.5 with no optimization costs $8,400 a month. Haiku 5.5 with a cached prefix and batching costs $37.50, a 224x gap, and Sonnet 5.5 with the same two steps costs $675, 12x lower. That holds only where quality had already saturated. A task that needs Opus 5.5 still drops 6.2x, from $8,400 to $1,350, from caching and batching alone.
How the cached rows are computed: 1,500 million prefix tokens at the cache-read rate, plus 150 million variable tokens at the base input rate, plus 90 million output tokens. For Haiku 5.5 that is 1,500 x $0.01 + 150 x $0.10 + 90 x $0.50 = $15 + $15 + $45 = $75. For Sonnet 5.5 (cache read $0.10) it is $150 + $300 + $900 = $1,350, and for Opus 5.5 (cache read $0.20) it is $300 + $600 + $1,800 = $2,700. Batching halves the input and output rates, and the cache-read rate halves with them, so each cached figure halves. Cache writes are left out: one write of the 5,000 token prefix on Haiku 5.5 costs $0.000625, so 1,000 rewrites a month add about $0.63. The 5,000 token prefix is above every current Claude minimum. These figures assume the prefix is read on every call, which holds only while calls keep arriving within the cache lifetime. Your numbers will differ, which is why the diagnostic comes first.
When traffic is variable
Variable traffic changes two things: the 5-minute cache can cost more than no cache, and the flexible share of the load can move to cheaper slots.
Take the 5,000 token prefix on Haiku 5.5. Sent uncached it costs $0.0005 (5,000 tokens at $0.10 per million). A 5-minute cache write costs $0.000625, a 1-hour write $0.001, and a read $0.00005. Now picture a back-office job that calls the model once every 20 minutes. The 5-minute entry has expired by the next call, so every call pays the write: $0.000625, which is 25% more than not caching. A 1-hour entry survives the 20-minute gaps and refreshes on each use, so after the first write every call pays $0.00005, a tenth of the uncached price.

Use the 5-minute cache when calls arrive more often than every 5 minutes, since every hit refreshes it at no charge. Use the 1-hour cache when gaps run between 5 minutes and an hour.
Then split the load by urgency. Requests a person is waiting on go to the synchronous API at standard rates. Everything else goes to a queue that drains through the Batch API at 50% off or, on DeepSeek’s own API, into off-peak hours. DeepSeek charges half its peak rate off-peak, so V4.1 Flash costs $0.15 input and $0.60 output per million tokens instead of $0.30 and $1.20. Peak is 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays, excluding Chinese public holidays, and every other hour is off-peak. The 300,000-call example costs $603 at peak rates and $301.50 off-peak.
Do not buy speed to absorb a burst. GPT-6.1 Sol’s Fast tier costs $4 input and $20 output per million tokens, double the Standard $2 and $10. Anthropic lists Claude Haiku 5.5 as its fastest current model, so for latency-sensitive bursts the cheaper model may already be the faster one.
Four ways the bill grows on its own
The bill moves without a code change in four ways, and each one reopens after you have closed it.
A model upgrade that changes the defaults. Current Claude model IDs are pinned snapshots, so the model behind claude-sonnet-5-5 does not move under you. The change arrives when you move to a newer ID. Default effort is high on Sonnet 5.5 and Fable 5.1 and medium on Opus 5.5 and Haiku 5.5, so an upgrade can change how many output tokens a call uses without any change to your prompt. Keep the exact ID in your config and promote a new one when your evals say so.
A new tokenizer counting the same text differently. Claude 4.7 and later models produce approximately 30% more tokens for the same text, and the exact increase depends on the content. Moving a Sonnet 4.6 workload at $3 per million input tokens to Sonnet 5.5 at $2 looks like a third off. With 30% more tokens the effective rate is about $2.60 per million tokens of the old count, a saving closer to 13%. Re-measure your real prompts after any model change instead of reusing old token counts.
Retries billing as full calls. Invalid JSON, a truncated response, a timeout: each retry is a complete charge. If your real calls-per-request ratio is 1.4 and you budgeted 1.0, you are 40% over on a line nobody tracks. Log it.
Long prompts crossing a price threshold. Claude Haiku 5.5 bills a request whose prompt runs over 100,000 tokens at $0.50 input and $2.50 output, five times the standard rate, and the count includes cache reads and writes. GPT-6.1 Sol prices a request over 272K input tokens at 2x input and cache rates and 1.5x output for the full request. A feature that appends retrieved documents can push a few requests over the line, and those few requests carry the higher rate.
The measurement habit that holds it together
Every lever above degrades silently if you stop watching. Three numbers, logged per task, catch all of it:
- Tokens per request, input and output separately. Catches tokenizer changes and prompt creep.
- Cache hit rate, from the usage fields on your responses. Catches a broken or undersized prefix, which is invisible otherwise.
- Cost per completed task, not cost per token. The only number that survives a model swap, a tokenizer change and a price change all at once.
The third one is the whole discipline. Two models at the same per-token rate can bill you 30% apart on the identical job. The rate card is not the invoice.
Before you downgrade anything, build a small evaluation set and run it before and after each change. A cheaper model still returns a confident, plausible answer when it is wrong, and nothing errors. With the set, the quality cost of a saving is a number you can see rather than a surprise your users find first.
Three controls put that evaluation set to work. Quality-gated cascade routing starts each task on a cheap model and escalates to a stronger one only when the task fails a quality check. It works because quality saturates on high-volume extraction, classification and formatting work: you define the check, and only the requests that fail it reach the stronger model.
Semantic response caching stores a completed answer and returns it for the identical request. Use it only when both the request and the answer are safe to reuse. A stable, non-personalized question with a stable answer qualifies. Anything carrying user context, a changing timestamp or a freshness requirement does not. Prefix caching reuses the processed input and semantic caching reuses the whole answer, so a request can benefit from one or both.
Measure cost per task by function or endpoint, because a single blended token price hides which workflow is expensive. Two endpoints at the same per-token rate can land far apart once retries, cache hits and output length are counted.
Where a gateway fits
A gateway turns lever 1 into a string change. Routing per task needs several models across more than one vendor, which normally means separate accounts, keys, SDKs, billing and failure modes before you save a dollar. That friction is why teams often hardcode one model and carry the 40x gap on their highest-volume workload.
An AI API gateway removes it: one OpenAI-compatible endpoint, many models behind it, one bill. Switching a task’s model becomes a string change instead of an integration project, which also makes benchmarking cheap. Running your eval set across five models is a loop over five strings, not five integrations. Measure across models, then route each task to the one that passed.
MixRoute is built for that loop. One OpenAI-compatible base URL, https://api.mixroute.ai/v1, serves 250+ models at no markup, and the model ID is the only thing that changes between claude-haiku-5-5, claude-sonnet-5-5, gpt-6-luna and deepseek-v4.1-flash. Each model page in the MixRoute model catalog lists its own rates, so read the page for the model you pick before you set a budget.
If you would rather not write the routing rule yourself, Smart Routing picks a model for each request by its complexity and cost. It carries no routing fee, so you pay only for the model it selects. It adds one step before the model call, so keep latency-critical endpoints on a fixed model ID.
If the next step is to manage several providers through one route, see AI API gateway cost tracking.
FAQ
How can I reduce my LLM API costs? Work through four steps in order: route each task to the cheapest model that clears your quality bar, cache your stable prompt prefix, batch anything a human is not waiting on, and trim tokens last. On the 300,000-call example these compound from $8,400 a month on Opus 5.5 to $37.50 on Haiku 5.5, or $675 on Sonnet 5.5. Start by measuring your input to output token ratio, because it determines which lever matters most for your product.
What is the biggest driver of AI API costs? Model choice, by a wide margin. The same workload costs $8,400 a month on Opus 5.5 and $210 on Haiku 5.5, because quality saturates early on high-volume work like extraction and classification. Prompt length is the smallest lever.
Does prompt caching actually save money? Yes, when your prefix is stable, reused and long enough to qualify. Anthropic bills a cache read at 0.1x the base input rate (0.05x on Opus 5.5 and Sonnet 5.5, 0.025x on Fable 5.1), and a 5-minute cache write costs 1.25x, so it is profitable from the first hit. It fails when the prefix changes between calls, when the prompt is below the model’s minimum cacheable length, or when calls arrive more than 5 minutes apart and the entry expires before reuse.
What is the minimum prompt size for Claude prompt caching? It varies by model. Claude Fable 5.1, Opus 5.5, Opus 5, Sonnet 5.5, Fable 5 and Haiku 5.5 need 512 tokens. Opus 4.8, Sonnet 5, Sonnet 4.6 and Sonnet 4.5 need 1,024, Opus 4.7 needs 2,048, and Opus 4.6, Opus 4.5 and Haiku 4.5 need 4,096. OpenAI’s GPT-5.6 and later models need 1,024 visible input tokens. Prompts below the threshold are processed without caching and no error is returned, so check the usage fields to confirm a cache happened.
Why did my AI bill go up when I did not change anything? Common causes: a model upgrade that changed the default reasoning effort, a newer tokenizer counting the same text as about 30% more tokens, retries billing as full calls, or a few long prompts crossing a price threshold such as Haiku 5.5’s 100,000 tokens. None of these throw errors, which is why they go unnoticed.
Is it cheaper to use one model or several? Several, routed by task. A single model means you either overpay on bulk work or underdeliver on the work that matters. Different tasks have opposite requirements, and the cost spread between the right and wrong model on high-volume work can reach 40x.
Should I use batch processing for AI API calls? Yes for anything asynchronous. Anthropic’s Batch API gives 50% off both input and output, most batches finish within an hour, and a batch that has not completed in 24 hours expires. It stacks with prompt caching. The test is whether a human is waiting on the response right now. If not, batch it.
How do I reduce LLM API costs when traffic is variable? Fix the cache first, then move flexible work off the busy path. If calls arrive more than 5 minutes apart, a 5-minute Anthropic cache costs 25% more than no cache on Haiku 5.5 ($0.000625 against $0.0005 for a 5,000 token prefix), so switch to the 1-hour cache. Send anything nobody is waiting on to the Batch API, or run it in DeepSeek’s off-peak hours at half the peak rate.
The bottom line
Cutting an AI bill is not about writing shorter prompts. Run the diagnostic first, since the input to output ratio tells you which lever your bill responds to, then work down the list in order. Keep an evaluation set, because a cheaper model that got worse will not tell you.
With MixRoute, sending a task to a different model is a model ID change on the same OpenAI-compatible endpoint, with no markup on top of the model’s price. Start building on MixRoute