If you want to reduce LLM API costs, the instinct is to switch to a cheaper
model. That is usually the last lever worth pulling, not the first. The cheaper
wins sit in how requests are shaped: whether the repeated part of your prompt
is cached, whether work that does not need an instant answer is batched, and
whether every request really needs your most expensive model.
This post goes through those three levers in the order they tend to pay off, with
the mechanics from the providers' own documentation, and the mistakes that
quietly switch the savings off.
Which lever saves the most?
| Lever | What it changes | Needs a quality trade-off? | Effort |
|---|
| Prompt caching | Price of the repeated prefix | No | Low: reorder the prompt |
| Batch processing | Price of non-urgent work | No, but you wait | Low to medium |
| Model routing | Which model handles which task | Yes, measure it | Medium to high |
| Shorter outputs and context | Tokens per request | Sometimes | Ongoing |
The first two reduce price without touching answer quality. Routing and trimming
do, which is why they come with an evaluation requirement (more on that below).
How does prompt caching reduce LLM API costs?
Most production prompts are mostly the same every time: a long system prompt,
tool definitions, a policy document, a few examples. Prompt caching lets the
provider reuse the work it already did on that identical prefix and bill the
reused part at a discount.
Anthropic's prompt caching documentation
sets out the pricing structure:
- A 5-minute cache write costs 1.25× the base input price; a 1-hour write
costs 2×.
- A cache read costs 0.1× the base input price on most models, and less on
some newer ones (the docs list 0.05× for Claude Opus 5.5 and 0.025× for Claude
Fable 5.1).
- The cache is refreshed at no extra cost each time cached content is used.
OpenAI's prompt caching guide
describes a similar shape for its newer models: caching triggers automatically
on identical prompt prefixes, reads cost 0.1× the normal rate on most models,
writes cost 1.25×, and a cached prefix stays eligible for 30 minutes after its
most recent use. Older models have different options, so check the guide for the
model you actually use.
What does that look like in numbers?
An illustration, using the Claude Opus 5.5 figures from Anthropic's docs ($4 per
million base input tokens, $5 for a 5-minute cache write, $0.20 for a cache
read). Assume a 10,000-token stable prefix reused across 1,000 requests inside
the cache lifetime. Counting only that prefix, not the user's question or the
output:
| Approach | Prefix cost for 1,000 requests |
|---|
| No caching | 10M tokens × $4/M = $40.00 |
| With caching | 1 write ($0.05) + 999 reads ($2.00) = about $2.05 |
This is arithmetic on published list prices, not a measured result from any
system, and real savings depend on your hit rate, your traffic gaps and the
share of each request that is stable. But it shows why the prefix is where to
look first.
Why is my cache hit rate low?
Caching fails silently. You do not get an error; you just keep paying full
price. The provider docs point at the same causes:
- A varying value near the front of the prompt. Anthropic's docs describe the
right pattern as a static prefix with the varying suffix after it: timestamps,
per-request context and the user message belong at the end, and the breakpoint
goes at the end of the static part. Put a timestamp at the top and nothing
ever matches.
- Changing tool definitions. In Anthropic's cache hierarchy (tools, then
system, then messages), modifying tool definitions invalidates the entire
cache.
- Prompts below the minimum length. Anthropic's docs say shorter prompts
cannot be cached even if marked, and no error is returned. The minimum varies
by model, from 512 to 4,096 tokens.
- Traffic gaps longer than the cache lifetime. A 5-minute cache does not
help a workload that fires once every ten minutes. That is what the 1-hour
option is for, at a higher write price.
- Rewriting conversation history. OpenAI's guidance is to preserve history by
appending rather than rewriting.
The fix for all of these is the same habit: read the usage fields your provider
returns (Anthropic reports cache_read_input_tokens and
cache_creation_input_tokens) and track the hit rate like any other production
metric. If you are already investing in monitoring, our post on
AI agent observability cost covers what to
budget for it.
When is batch processing worth it?
If the answer is not needed immediately, such as classification of a backlog,
nightly summarisation, bulk extraction or running an evaluation suite, batch
APIs trade latency for price.
Anthropic's Message Batches documentation
states a 50% cost reduction. A batch is limited to 100,000 requests or 256 MB,
most batches finish within an hour, and a batch expires if not complete within 24
hours. The docs also say batch pricing and prompt caching discounts can stack,
with the caveat that because requests are processed concurrently, cache hits are
best-effort, with typical hit rates between 30% and 98% depending on traffic.
For batches with shared context they suggest the 1-hour cache duration.
The rule of thumb: anything a user is not actively waiting for is a batch
candidate. Anything interactive is not.
Should every request use your best model?
Probably not, but this is the lever to be most careful with, because it is the
only one of the three that can degrade quality without telling you.
Routing means sending each task to the cheapest model that does that task well
enough: a small model for classification, extraction and routing decisions, a
larger one for open-ended reasoning and hard edge cases. The risk is obvious:
"well enough" is a claim, and you need evidence for it.
A workable sequence:
- Write the evaluation set first. A few dozen to a few hundred real examples
per task, with a pass/fail definition. Our
AI agent evaluation framework post
covers how to build one.
- Run the cheaper model against it. If it passes at the same rate, route to
it. If it does not, you have a number to argue about instead of a feeling.
- Keep an escalation path. Let the small model hand uncertain cases to the
large one rather than guessing.
- Re-run on every model change. Providers retire and replace models; a
routing table is only as good as its last evaluation.
If fine-tuning a smaller model is on the table as a cost play, the volume maths
is in RAG or fine-tuning: how to choose without burning a quarter.
What do the three levers cost on real models?
Listed prices per million tokens, from Anthropic's
pricing page:
| Model | Input | Output |
|---|
| Claude Opus 5.5 | $4 | $20 |
| Claude Sonnet 5.5 | $2 | $10 |
| Claude Haiku 5.5 (prompts up to 100K tokens) | $0.10 | $0.50 |
Haiku 5.5 is a twentieth of Sonnet 5.5's list price — which is exactly why
routing is worth the evaluation work. Putting the three levers side by side on
one workload makes the gap concrete. This is an illustrative calculation on
the list prices above, not a measured result from any client: 1,000
requests, each with a 6,000-token fixed prefix, 500 tokens of variable input
and 300 tokens of output, on Sonnet 5.5. The cache write premium on the first
request is ignored.
| Scenario | Input cost | Output cost | Total |
|---|
| Baseline, no optimisation | 6.5M × $2 = $13.00 | 0.3M × $10 = $3.00 | $16.00 |
| Prompt caching | 6M × $0.10 + 0.5M × $2 = $1.60 | $3.00 | $4.60 |
| Batch only (50% off) | $6.50 | $1.50 | $8.00 |
| Same workload on Haiku 5.5 | 6.5M × $0.10 = $0.65 | 0.3M × $0.50 = $0.15 | $0.80 |
Caching alone takes this workload down by about 71%. Notice that output cost
becomes the floor once input is cached — the $3.00 of output dominates the
$4.60 total, which is why shorter outputs and structured formats matter more
than they look. Whether the Haiku row is acceptable is an evaluation question,
not an arithmetic one, and because batch jobs may not hit the cache the way
interactive traffic does, measure the combination rather than multiplying the
discounts.
What else adds to the bill?
- Context that keeps growing. Agents that re-send an ever-larger history are
paying for it on every call; see
AI agent memory cost for the tiered approach.
- Output length. Output tokens are generally priced higher than input tokens
on major providers, so asking for concise structured output matters more than
it looks. Check your provider's price sheet for the ratio on your model.
- Retries. A flaky tool or a strict schema that triggers repeated retries
multiplies the cost of a request invisibly.
What to do next
- Find your biggest stable prefix. System prompt, tools, reference
material. Move everything that varies per request to the end.
- Turn on caching and watch the hit rate for a week before judging it.
- List your non-interactive workloads and move them to a batch API.
- Only then consider routing, and only with an evaluation set in place.
If you are building an AI product and want a second pair of eyes on where the
tokens are going before you scale, our AI SaaS work covers
architecture reviews like this one. Provider prices and model lineups change
often, so treat every figure here as a snapshot and confirm against the current
price sheet before you plan around it.