Prompt Caching: Anthropic vs OpenAI — A Developer's Complete Guide
TokenCheat Team
5/3/2026

Prompt caching is the single largest cost lever for high-volume AI workloads. Both major providers now price cache reads at 10% of the input rate — the real differences are in write charges, TTL control, and how easily you bust the cache. Prices below are verified against provider pages as of 2026-07-02.
Anthropic: Automatic with cache breakpoints
Anthropic's caching activates on repeated prompt prefixes. Key mechanics:
- Discount: cache reads bill 10% of the input rate. On Opus 4.8, that is $0.50/M instead of $5/M.
- Write cost: 25% surcharge (1.25× input) on the first write for the default 5-minute TTL. A 1-hour TTL is available at 2× input.
- Breakpoints: per Anthropic's docs, you can insert up to 4 cache breakpoints to control exactly where caching boundaries fall, and there is a minimum cacheable prefix length (1,024–2,048 tokens depending on model).
| Model | Input | Cache write (5m) | Cache write (1h) | Cache read |
|---|---|---|---|---|
| Claude Fable 5 | $10.00 | $12.50 | $20.00 | $1.00 |
| Claude Opus 4.8 | $5.00 | $6.25 | $10.00 | $0.50 |
| Claude Sonnet 5 | $2.00 | $2.50 | — | $0.20 |
| Claude Sonnet 4.6 | $3.00 | $3.75 | $6.00 | $0.30 |
| Claude Haiku 4.5 | $1.00 | $1.25 | $2.00 | $0.10 |
(Sonnet 5 rates are intro pricing through 2026-08-31.)
The 5-minute TTL means rapid-fire requests (agent loops, multi-turn sessions) benefit enormously. Batch jobs with longer gaps between calls should price out the 1-hour tier instead.
OpenAI: Automatic for long prompts
OpenAI's approach is simpler but less configurable:
- Discount: cache reads also bill 10% of the input rate — $0.50/M on GPT-5.5 against $5/M input.
- Write cost: none. OpenAI does not charge for cache writes, so there is no surcharge to amortize.
- Activation: automatic for prompts past a minimum length (~1,024 tokens per OpenAI's docs). No opt-in needed.
- TTL / granularity: not user-configurable; OpenAI manages eviction and caches the longest matching prefix. No explicit breakpoints.
| Model | Input | Cache read |
|---|---|---|
| GPT-5.5 | $5.00 | $0.50 |
| GPT-5.4 | $2.50 | $0.25 |
| GPT-5.3 Codex | $1.75 | $0.175 |
| GPT-5.4 mini | $0.75 | $0.075 |
The old framing — "Anthropic gives 90% off, OpenAI only 50%" — is obsolete. Both discount to 10% of input. Anthropic charges writes but gives you breakpoint and TTL control; OpenAI writes are free but you steer nothing.
Google: Explicit context caching
Google takes a different approach entirely:
- Mechanism: you explicitly create a cached-context object via API, then reference it in subsequent requests (implicit prefix caching also exists).
- Billing: cache reads bill 10% of input (Gemini 2.5 Pro: $0.125/M vs $1.25/M), plus an hourly storage charge for explicit caches — e.g., $1.00 per 1M tokens per hour on Gemini 3.5 Flash, per Google's pricing page.
- Control: full TTL control. You decide when to create and expire caches.
- Best for: long-running workloads with very stable context (e.g., a large codebase summary cached for an 8-hour workday) — where storage cost amortizes across many reads.
Best practices (all providers)
Put stable content first. Caching works on prefixes. Your prompt structure should be:
- System prompt (most stable)
- Tool schemas (stable per session)
- Examples and few-shot demonstrations (stable per task type)
- Conversation history (changes every turn)
- Current user input (always unique)
If you put variable content before stable content, nothing after it can cache.
Never change system prompts per-request. Injecting timestamps, request IDs, or per-user metadata into your system prompt busts cache for everything below it. Move dynamic data to the end of the prompt or into tool call parameters.
Measure cache hit ratio. Anthropic returns cache_read_input_tokens and
cache_creation_input_tokens in every response. Track the ratio:
cache_reads / (cache_reads + cache_creation). A reasonable target for
agentic coding workloads is 70–90%.
The math that matters
Consider a typical AI coding workflow: 50,000 requests/month, 2,000 cacheable tokens per request (system prompt + tool schemas) = 100M cacheable tokens. Assume a 90% cache hit rate — 10M tokens miss (and, on Anthropic, get written to cache at 1.25×), 90M read from cache.
| Scenario | Cost calculation | Monthly cost |
|---|---|---|
| Claude Opus 4.8, no caching | 100M × $5.00 | $500.00 |
| Claude Opus 4.8, 90% hits | 10M × $6.25 + 90M × $0.50 | $107.50 |
| GPT-5.5, no caching | 100M × $5.00 | $500.00 |
| GPT-5.5, 90% hits | 10M × $5.00 + 90M × $0.50 | $95.00 |
That is roughly a 79–81% cut on the cacheable portion of the workload — at identical hit rates the two providers land within a few percent of each other. Run your own volumes through the caching calculator.
Common mistakes
Changing tool descriptions dynamically. If your MCP server generates slightly different descriptions per session, tool schemas cannot cache. Lock them down.
Prepending user context before the system prompt. Some frameworks inject user metadata at the top. Move it after the stable prefix.
Overestimating the write penalty. Anthropic's 25% write surcharge scares people off, but the break-even is a single reuse: one write plus one cache read costs 1.25× + 0.10× = 1.35× the input rate, versus 2.0× for sending the same prefix uncached twice. Only genuinely one-shot prompts lose money on caching.
TokenCheat's cache efficiency analysis measures your actual hit ratio and flags prompts that are busting cache unnecessarily — teams frequently discover a slice of requests paying full price due to avoidable prefix instability. Start with the free stack audit.