The Research Report
Prompt Caching: The One Fix That Cuts Your API Bill 50-90%
Your LLM bill is mostly paying for the same tokens over and over.
System prompts. Tool definitions. Few-shot examples. That 30,000-token retrieval context you stuff into every request. None of it changes between calls — but you pay full price for it every single time.
Prompt caching fixes that. Both OpenAI and Anthropic now let you cache static prompt prefixes and pay 80-90% less to reuse them. One team cut their monthly API spend from $612 to $167 with two weeks of refactoring. Another hit a 90% cache hit rate on root-cause analysis calls and watched their per-call input cost drop to a tenth of what it was.
Here's how it works, what the discount tiers actually are, and how to refactor your existing prompts for cache efficiency.
What Prompt Caching Actually Does
When you send a prompt, the model computes internal representations (key-value tensors) for every token. For a 100K-token prompt, that's a lot of compute — and it happens from scratch every time, even if 90% of those tokens were in your last request.
Prompt caching stores those tensors on the provider's side. On subsequent requests with the same prefix, the provider reuses the cached version instead of recomputing. You pay a small premium on the first write, then a steep discount on every read.
The economics are simple: cache write costs slightly more than base input. Cache read costs 80-90% less. If you reuse the same cached segment more than about 1.25 times within the TTL window, you come out ahead. Past that threshold, the savings compound fast.
The Discount Tiers: OpenAI vs Anthropic
OpenAI
Caching is automatic and free. No code changes required. You get it by default on prompts of 1024 tokens or more, running on GPT-4o and newer models.
The discount: up to 90% off cached input tokens. Latency drops up to 80% on cache hits because the provider routes you to servers that already have your prefix processed.
There's no separate write fee — caching is bundled into the base price. OpenAI handles the cache lifecycle transparently. You can tune cache behavior with the promptcachekey parameter to influence routing and improve hit rates when many requests share a common prefix.
Two retention tiers:
- In-memory: 5-10 minutes of inactivity, up to 1 hour max. Available for most models.
- Extended (24-hour): Available for GPT-5.5, GPT-5.5-pro, GPT-5.4, GPT-5.2, and future models. Offloads key/value tensors to GPU-local storage when memory fills up. This is the default for GPT-5.5 and future models.
Extended caching keeps your cache alive for up to 24 hours. If your traffic patterns are bursty (quiet periods followed by spikes), the longer TTL means you don't pay cache-write penalties every time a quiet spell ends.
Anthropic
Anthropic gives you explicit control. You mark the cache breakpoint in your API call with a cache_control block. This lets you cache exactly the segments you want — not the whole prompt.
Pricing is transparent:
| Token category | Cost |
|---|---|
| Base input | $1.00/M tokens (Haiku 4.5) |
| Cache write (5-min TTL) | $1.25/M tokens |
| Cache read | $0.10/M tokens |
| Output | $5.00/M tokens |
Same pattern as OpenAI: write once at a 25% premium, read forever at 10% of base cost. The difference is you decide where the cache starts and stops.
Default TTL is 5 minutes. You can extend to 1 hour with cache_control: { type: "ephemeral", ttl: "1h" }. For agent loops that run 15-25 minutes per session, the longer TTL pays for itself in eliminated re-writes.
Minimum cacheable prefix: 1,024 tokens on Sonnet models, 2,048 on Opus.
The One Rule That Determines Whether Your Cache Hits
Cache hits only work for exact prefix matches. The same tokens, in the same order, with the same whitespace.
This means prompt structure is everything. Static content — system instructions, tool definitions, few-shot examples, retrieval context — has to sit at the top. Dynamic content — per-user variables, conversation history, incident-specific details — has to sit at the bottom.
Get this wrong and you cache nothing useful.
The breakpoint goes at the transition from "same every time" to "different every time." Mark the last static block with a cache control hint. On Anthropic, that's cache_control: { type: "ephemeral" } on the final static segment. On OpenAI, the cache operates automatically based on prefix matching — structure your prompts the same way and let the system route accordingly.
How to Refactor an Existing Prompt for Cache Efficiency
Step 1: Break your prompt into layers
Go through your prompt and classify every block:
- Always static — system instructions, tool definitions, output schema. Changes once per deploy. Highest value to cache.
- Semi-static — retrieval context, per-tenant guidelines, few-shot examples. Changes every few minutes or per customer.
- Dynamic — user input, conversation history, per-incident details. Changes every request.
The first two layers are your cache candidates. The third layer always pays full price.
For example, a typical RCA (root cause analysis) call might look like:
- System prompt: ~1,200 tokens, identical everywhere → cache segment 1
- Retrieval context (3 prior similar incidents): ~600 tokens, stable within a batch run → cache segment 2
- Incident events: 2,000-3,000 tokens, unique per incident → uncached
- Output: generated fresh every time → unaffected by caching
In that shape, 70-80% of input tokens are cached. Cache read costs one-tenth of base input. Net input cost drops 60-70%.
Step 2: Watch out for the variable-substitution trap
A common mistake: templating a cached block with {{customer_name}} or {{date}} per request. Even a tiny variable inside your static prefix breaks the cache key for the entire prefix. The fix is simple: move all variable substitution below the cache breakpoint. If a value must appear in a tool description, hard-code it in a per-user wrapper rather than inlining it into the cached block.
Same goes for whitespace. Concatenate with \n\n in one place and \n in another and you've got two distinct cache keys. Pick one separator and lint for it.
Step 3: Cache your tool definitions
On Anthropic, tool definitions are cacheable if you mark the last tool with cache_control. For an agent with 14 tools totaling 9,800 tokens, this single fix dropped per-turn costs by 31% in one production case. Tool definitions are almost always stable across a deploy and are the highest-leverage thing to cache after system prompts.
Step 4: Set the right TTL
Default 5-minute TTL works for steady, dense traffic. For bursty traffic — a customer session that runs 20 minutes with gaps, or batch jobs that cluster at 2 AM — the cache keeps expiring before the work finishes. Switching to 1-hour TTL costs slightly more per write but eliminates re-write costs throughout the session.
Measure before tuning. If your cache hit rate sits below 40% after a day, something is wrong — usually a non-deterministic field somewhere in the supposed-static prefix, like a timestamp accidentally baked into a tool definition.
Step 5: Verify the cache is actually hitting
Every response from both providers includes a usage object with cache statistics. On Anthropic: cachecreationinputtokens and cachereadinputtokens. On OpenAI: cachedtokens in prompttokensdetails. Log these. Watch the cachedtokens / totalprompttokens ratio. If cache reads aren't appearing after your first few requests, your breakpoint placement is wrong.
Real Numbers From Production
Here's what happened for one team after a focused two-week refactor across six AI products:
| Product | Shape | Pre-cache | Post-cache | Reduction |
|---|---|---|---|---|
| Exam generator | Long static prefix + short dynamic input | $182/mo | $41/mo | 77% |
| Food scanner | Image + short prompt | $94/mo | $71/mo | 24% |
| Revenue assistant | Agent loop + tool definitions | $168/mo | $32/mo | 81% |
| Document summarizer | Large doc + summary request | $71/mo | $58/mo | 18% |
| Helpdesk bot | Long conversation + tools | $56/mo | $11/mo | 80% |
| Content studio | Stable system + variable input | $41/mo | $14/mo | 66% |
| Total | $612/mo | $227/mo | 63% |
The 73% headline number came after a second round of cleanup — moving image preprocessing to a smaller model and merging redundant tool definitions. The raw caching win was 63%. The rest came from optimizations the cache audit surfaced.
Notice the products where caching barely moved the needle. The food scanner and document summarizer had minimal repeatable prefix — every image is new, every document is new. There was nothing meaningful to cache. If your workload looks like that, caching isn't your highest-leverage lever. Model selection probably is.
When to Cache, When Not to
Caching isn't free. The write penalty means it only pays off if your prefix is reused enough. Before investing engineering time in cache-aware prompt restructuring, run through this checklist:
- Is the prefix at least 1,024 tokens? Below that, neither provider caches it.
- Does the same prefix repeat in at least 50 requests/hour? If not, write overhead exceeds read savings.
- Is the prefix stable for at least an hour? If it changes constantly, you'll burn write costs without amortizing them.
- Does the workload run agent loops or multi-turn conversations? Bigger prefix, bigger win. Agentic apps with 8-15 tool calls per task are where caching saves 60-85%.
- Is the workload single-shot with low repeat rate? Probably skip it.
Measure hit rate weekly. If it sits below 40%, turn caching off and reinvest the effort elsewhere.
The Cheapest Test You Can Run
Count how many tokens in a typical request are byte-for-byte identical to the previous request. Not "semantically the same" — literally identical, same whitespace, same order.
If the answer is more than 50%, you're leaving money on the table. Ship cache-aware prompt restructuring and watch the input-cost line item drop on the next billing day.
If the answer is less than 20%, your prompts are designed for context, not for repetition. Caching won't help much without a structural rewrite. Either way, knowing the number is a one-hour exercise that beats arguing about whether caching is worth the complexity.
Citations
- Prompt Caching | OpenAI API
- Prompt Caching 201 | OpenAI Cookbook
- Anthropic prompt caching cut our RCA cost by 90% | Culprit
- How I Cut Our LLM API Bills by 73% With Prompt Caching | AICraftGuide
- How We Got Aura's Cache Hit Rate to 91% | Aura
- Anthropic vs OpenAI Prompt Caching: When It Pays Off | TechPlained
- How I Cut My Claude API Bill in Half With Prompt Caching | Claude Lab
Suggested title: The Prompt Caching Playbook: How to Cut Your LLM API Bill 50-90%
Word count: ~1,800 words
Fact-check notes:
- The $612 → $167 case study comes from AICraftGuide, published 2026. Verify the numbers are current before citing in a paid context.
- Anthropic cache write premium is 1.25x base input per their docs. Confirm current pricing on Anthropic's pricing page, as providers update these tiers.
- OpenAI extended cache (24h) is confirmed for GPT-5.5 and future models. Verify for any models you're running in production.
- The 90% cache hit rate from Culprit is for RCA calls specifically — a workload with unusually stable prefixes. Your mileage will vary based on prompt structure.