Context Caching Verdict: Prompt caching cuts input costs by 90% on Anthropic and DeepSeek, and 75% on Google Gemini for repetitive document analysis and agent system prompts. DeepSeek V3 provides the industry's lowest cache hit rate at $0.014 per 1M tokens, while Gemini 2.0 Flash offers explicit TTL controls down to $0.025/1M. See dedicated TTL math in Claude TTL Burn Calculator and compare models in Gemini 2.0 Flash Lite.
Context caching provides an immediate 50% to 90% reduction in LLM input token expenses across long-document RAG, codebases, and agentic loops. DeepSeek V3 offers the cheapest automatic disk caching at $0.014 per 1M tokens (90% discount). Anthropic Claude delivers an automatic 90% discount ($0.30 per 1M) via ephemeral 5-minute windows with a 1.25x cold-start write penalty. Google Gemini provides a 75% read discount ($0.025/1M on Flash), but requires high query frequency (15+ queries/hour) to offset its $1.00/1M/hour storage charge.
DeepSeek V3 Cache Hit$0.014 / 1M tokens
Anthropic Claude Cache Hit$0.30 / 1M tokens
Gemini 2.0 Flash Cache Hit$0.025 / 1M (+ storage)
OpenAI GPT-4o Cache Hit$1.25 / 1M tokens
Context Caching Mechanics by Provider: 2026 Comparison
Examine write penalties, hourly storage fees, minimum token lengths, and TTL eviction policies across all four major providers.
Provider / Model
Cold-Start Write Price
Cache Read Hit Price
Hourly Storage Charge
Minimum Token Threshold & TTL
DeepSeek V3 / V3.1
$0.14 / 1M
$0.014 / 1MLowest Cost
$0.00 (Zero Storage Fee)
64 tokens • Automatic LRU eviction.
Google Gemini 2.0 Flash
$0.10 / 1M
$0.025 / 1M
$1.00 / 1M tokens / hour ($4.50/day)
32,768 tokens • Explicit user-defined TTL.
Anthropic Claude 3.7 / 3.5 Sonnet
$3.75 / 1M (1.25x surcharge)
$0.30 / 1M (90% discount)
$0.00 (Zero Storage Fee)
1,024 tokens • Ephemeral 5-min TTL (resets on hit).
Verdict: Prompt caching saves $3,561/month (93.1% savings). Ephemeral prompt caching transforms an unaffordable $3,800 monthly bill into a $263 line item.
Scenario B: High-Volume Wall Street SEC 10-K Analysis
Verdict: Gemini explicit caching is 33x cheaper. Because query velocity is high (83 queries/hr), the $72/month storage fee is completely overshadowed by the 75% read discount.
Scenario C: Legal Discovery Litigation Vault
200,000 token trial record • Only 5 queries/day • Low Frequency
A boutique law firm reviewing deposition transcripts occasionally across a 30-day trial preparation phase.
Gemini Explicit Cache (Low Velocity Trap):
200k tokens stored 720 hours ($1/1M/hr)$144.00
150 queries × 200k toks ($0.025/1M)$0.75
Gemini Cache Total:$144.75 / mo
Gemini Flash Standard (Uncached Pay-As-You-Go):
150 queries × 200k toks @ $0.10/1M$3.00
Storage charges$0.00
Standard Total:$3.00 / mo
Verdict: Do NOT use explicit caching for low-frequency queries! At only 5 queries/day, paying hourly storage fees costs $144 vs only $3 for standard pay-as-you-go querying.
Architectural Deep-Dive: Ephemeral vs Explicit vs Disk Caching
Why prompt caching implementations diverge across providers, and how to avoid the "storage fee trap."
1. Anthropic: The Ephemeral 5-Minute Window
Anthropic operates on an ephemeral time-to-live model:
When you mark a content block with cache_control: {"type": "ephemeral"}, Anthropic writes the Key-Value (KV) attention states to high-speed GPU memory and charges a 25% write surcharge ($3.75/1M).
For the next 5 minutes, every subsequent query hitting that exact prefix pays only $0.30/1M (90% off) and automatically refreshes the 5-minute timer.
If 5 minutes elapse without a hit, the cache automatically evaporates without ongoing storage charges. This makes Anthropic ideal for interactive coding agents (Cursor, Cline) that make requests every 15-30 seconds.
2. Google Gemini: Explicit Caching & The Storage Fee Trap
Google Gemini takes an infrastructure approach: you explicitly create a named cache via client.caches.create() and define an exact lifespan (e.g., 24 hours). While cache read hits are extraordinarily cheap ($0.025/1M), Google charges an hourly rent of $1.00 per 1M tokens per hour.
The Golden Rule of Gemini Caching: You must send at least 15 queries per hour against the cache. If your query frequency drops below 15/hr, the cumulative hourly storage fees exceed the savings of the 75% read discount, making standard uncached querying cheaper!
3. DeepSeek V3: Zero-Overhead Automatic Disk Caching
DeepSeek eliminates both write surcharges and storage charges. Because Multi-Head Latent Attention (MLA) compresses the KV cache by 93%, DeepSeek can afford to store prompt prefixes directly on ultra-fast solid-state drives across its inference cluster. Any shared 64-token prefix automatically hits the cache at $0.014/1M with zero manual configuration.
Production Context Caching Checklist
Essential engineering practices before enabling context caching in your production application.
✓
1. Put Dynamic Timestamps at the End of Prompts:
Prompt caching matches prefixes from character 0 onward. If you put Current Time: 2026-10-02 22:45:12 at the top of your prompt, the entire prompt cache invalidates every second! Move all timestamps and user-specific inputs to the very bottom of the messages array.
✓
2. Verify Minimum Token Thresholds:
Anthropic and OpenAI require at least 1,024 tokens to activate prompt caching. Google Gemini requires 32,768 tokens. Caching small 200-token system prompts will produce 0 cache hits and waste developer effort.
✓
3. Implement Heartbeat Pings for Anthropic Ephemeral Caches:
If your users take 6-minute breaks between questions, the 5-minute ephemeral cache will expire, triggering a cold-start write surcharge. Send a background 1-token heartbeat ping at minute 4.5 to keep the cache alive during active sessions.
✓
4. Calculate Gemini Storage Break-Even Before Setting TTL:
Use our calculator above: if your document will be queried fewer than 15 times per hour, use standard uncached API calls rather than explicit context caching to avoid storage fee traps.
Frequently Asked Questions
How does Anthropic's prompt caching pricing work?
Anthropic Claude uses an ephemeral 5-minute cache. Initial cache writing incurs a 25% surcharge ($3.75 per 1M tokens vs $3.00 base). Subsequent cache read hits receive a 90% discount ($0.30 per 1M tokens). Each time a prompt hits the cache, its 5-minute TTL resets automatically. The minimum prompt threshold is 1,024 tokens.
How does Google Gemini context caching differ from OpenAI and Anthropic?
Google Gemini uses explicit context caches with developer-specified TTLs. Creation costs $0.00 extra (billed at standard input rate), but Gemini charges an hourly storage fee of $1.00 per 1 million tokens per hour ($4.50/1M/day on Flash). Cache read hits receive a 75% discount ($0.025/1M on Flash). The minimum cache threshold is 32,768 tokens.
How does OpenAI prompt caching work?
OpenAI applies automatic prompt caching on GPT-4o and o1 with zero configuration required. Initial writes are billed at normal input rates ($2.50/1M), subsequent prefix hits get a flat 50% discount ($1.25/1M), and there are zero storage or hourly fees. The minimum threshold is 1,024 tokens.
Why is DeepSeek V3's disk caching the cheapest in the industry?
DeepSeek V3 provides automatic disk caching with a 64-token minimum threshold. Cold inputs cost $0.14 per 1M, while cached hits cost only $0.014 per 1M tokens—a 90% discount with zero storage fees or write penalties. This is made possible by DeepSeek's Multi-Head Latent Attention (MLA), which compresses KV cache memory by 93%.
What is the break-even query frequency for Google Gemini context caching?
Because Google Gemini charges an hourly storage fee ($1.00/1M tokens/hour), you must send at least 15 to 20 queries per hour against the cached context to overcome the storage charge compared to standard pay-as-you-go querying. For low-frequency queries (e.g., 1 query every 4 hours), explicit caching is actually more expensive.
How do you structure prompts to maximize cache hit rates?
Always position static, immutable content at the beginning of the prompt: system instructions, tool definitions, reference PDF documents, and few-shot examples. Dynamic content (such as the user's latest message, chat history timestamps, and volatile session IDs) should strictly be appended at the end of the prompt.