What is prompt caching?
LLM providers can remember the internal state of tokens they have already processed. When your next request starts with the exact same prefix — a system prompt, a codebase file, a long product catalog — the model skips recomputing it and bills those tokens at a steep discount. Same answer quality, fraction of the cost, faster time-to-first-token too.
Provider-by-provider
OpenAI (GPT-4o, o-series)
Automatic — no code changes. Requests longer than 1,024 tokens are cached when the prefix repeats; cached input costs 50% of base input ($1.25/M instead of $2.50/M on GPT-4o). Cache hits survive 5–10 minutes of idle traffic, longer during off-peak hours.
Anthropic (Claude)
Explicit — mark breakpoints with cache_control. Cache writes cost
25% extra once; cache reads cost about 10% of base input.
Default TTL is 5 minutes, refreshable on each hit; a 1-hour TTL costs double to write.
Ideal for long agent sessions and RAG pipelines.
Google (Gemini)
Explicit via the context caching API. You create a cached content object (minimum 4,096 tokens), pay a per-hour storage fee, then read it at roughly 25% of base input. Best for very large, stable corpora queried many times per hour.
DeepSeek
Fully automatic with a tiny 64-token minimum. Cache hits cost about one-tenth of base input, making DeepSeek one of the cheapest options for repetitive workloads even before its low base prices.
A worked example
Say your app sends a fixed 8,000-token system + document prompt with every user question, at 1,000 requests/day, on GPT-4o:
- Without cache: 8,000 × 1,000 × $2.50/M ≈
$20/dayjust for input. - With ~80% cache hits: 200 misses × $0.02 + 800 hits × $0.01 ≈
$12/day. - On Claude with 90%-off reads: the same pattern drops input spend by nearly half again.
Run your own numbers with the cache-hit slider in the AITokenCalculator calculator — advanced options include cache hit rate, batch mode and reasoning effort.
Checklist to start saving today
- Move all static content to the front of your prompt.
- Keep prefixes byte-identical — no timestamps or random IDs inside them.
- Reuse one client/connection where possible; routing across pools can miss caches.
- Track the provider's cached-token metric in API responses to verify hits.
- Benchmark before/after with our cost-reduction playbook.