WiseCrewAI → Guides

Prompt Caching Explained — Save 80–90% on Repeated Context

6 min readUpdated 2026-08-20

Prompt caching stores a reusable prefix in server-side memory, so repeated calls pay 5–10× less. This guide covers how caching works across Anthropic, OpenAI, and Google, where it applies, and the critical mistakes that cause it to cost more than uncached.

What caching stores

Caching stores the KV (key-value) cache computed from a stable prefix — typically your system prompt, document context, or few-shot examples. On subsequent calls with the same prefix, the model skips re-processing it. Cache writes cost slightly more than standard input; cache reads cost significantly less.

Provider pricing comparison

Anthropic: write costs 1.25× (5-min) or 2.00× (1-hour) standard input; reads cost 0.10× (10× cheaper). OpenAI: no explicit write cost; cached tokens (system prompt matched) cost 0.25–0.50× standard input. Google: explicit cache write + $0.00001/token-hour storage; reads at 25–75% discount.

The TTL expiry trap

Anthropic caches expire after 5 minutes (default) or 1 hour (extended). If your calls are spaced more than 5 minutes apart, every call is a cache write — and writes cost MORE than standard input on 1-hour TTL. Check your call frequency before enabling caching.

What to put in the cache prefix

Ideal cache candidates: (1) System prompt + tool definitions (stable, large), (2) Document context for repeated queries on the same document, (3) Few-shot examples. Not ideal: variable user content, conversation history (changes every turn).

Break-even calculation

Anthropic 5-min caching breaks even at 2 calls (the second call covers the write premium). 1-hour TTL breaks even at 3 calls. OpenAI implicit caching breaks even at the first matching call. Any stable prefix used more than 3× per TTL window should be cached.

Related calculators

prompt caching calculatorprompt cost calculatoragent cost calculator

Related guides

how llm pricing workscache write vs cache read cost

Frequently Asked Questions

How do I enable prompt caching?

Anthropic: add {"cache_control": {"type": "ephemeral"}} to any content block to mark the cache boundary. OpenAI: system prompt caching is automatic for the first system message when it's long enough. Google: use the caching API to create a named cache object. Details in the Prompt Caching Savings Calculator.

Does caching affect response quality?

No. The cached KV states are mathematically identical to recomputing them. The model produces the same output whether the prefix came from cache or was recomputed.

Guide updated 2026-08-20. Pricing data verified weekly. See methodology · sources.