Prompt Caching Math: Cache Write Surcharges vs. Read Break-Even
Most online LLM calculators only model cached reads (0.02x–0.10x) and omit cache writes. On Anthropic (1.25x 5m / 2.0x 1h) and OpenAI (1.25x 30m / 2.50x 12h), low reuse or frequent prefix churn can make caching cost more than uncached calls.
Why Cache-Read-Only Calculators Misprice Agent Workloads
Calculators that only ask for a 'Cached input %' silently treat cache misses and cold cache writes as if they cost 1.0x—or worse, ignore write surcharges altogether. In reality, providers with explicit or tiered retention charge a higher total input rate when populating a cache entry.
Anthropic bills 5-minute TTL cache writes at 1.25x standard input ($2.50/1M on Claude Sonnet 5.5, $10.00/1M on Claude Fable 5.2) and 1-hour TTL cache writes at 2.0x standard input ($4.00/1M on Sonnet 5.5, $16.00/1M on Fable 5.2). OpenAI bills 30-minute in-memory writes at 1.25x ($2.50/1M on GPT-6.1 Sol) and 12-hour Responses API writes at 2.50x ($5.00/1M on GPT-6.1 Sol). Note that these write rates are total rates per written token, not additive surcharges.
Exact Break-Even Hits Per Cold Write
Suppose a prefix has P tokens, standard input rate R_in, cache read rate R_read = alpha * R_in, and cache write rate R_write = beta * R_in. Compared against sending N + 1 uncached requests (1 write-equivalent + N reads), caching breaks even when beta + N * alpha < N + 1, or N > (beta - 1) / (1 - alpha).
For a 5m/30m write (beta = 1.25) with a 90% read discount (alpha = 0.10), break-even is N > 0.25 / 0.90 = 0.28—meaning even a single subsequent cache hit within the TTL saves money. For a 1h Anthropic write (beta = 2.00, alpha = 0.10), break-even requires at least 2 cache hits per write (N > 1.11). For an OpenAI 12h write (beta = 2.50, alpha = 0.10), you need at least 2 hits (N > 1.67) and ideally 5+ hits to justify locking in 12h retention.
Zero-Write-Surcharge & Storage-Fee Exceptions
DeepSeek (98% off on DeepSeek-V4.1-Flash: $0.003 off-peak / $0.006 peak), Mistral (10% default via 64-token prompt_cache_key blocks, or $0.007 on hosted DeepSeek-V4.1-Flash), Groq (50% off on gpt-oss-20b/120b/safeguard-20b, 2h TTL), and Together AI (e.g., $0.006 on DeepSeek-V4.1-Flash, ~1h best-effort) charge $0 write surcharge.
Google Gemini introduces a third model: zero per-token write surcharge, minimum 4,096 tokens, but explicit context caching charges an hourly storage fee ($0.50/1M tokens/hour on Gemini 3.8 Flash through 2026-12-31, rising to $1.00/hr on 2027-01-01; $4.50/1M tokens/hour on Gemini 3.1 Pro Preview). Meanwhile, Gemini 4 Carbon supports implicit caching only (no explicit storage fee, but multi-turn requests require >=2,050 new tokens to extend the prior cache).
Test These Numbers on Your Own Workload
All calculations execute locally in your browser with zero server calls.