Prompt caching lets an LLM API skip reprocessing the start of a prompt that it has already seen. OpenAI describes it as reusing work when requests share the same prompt prefix, which makes the repeated input cheaper and the response faster to start. The model still generates a new answer every time. For agents that resend a long system prompt, tool list and history on every turn, it is one of the largest levers on input cost.
How it works
The shared piece is a prefix: the unchanged tokens at the start of the prompt. OpenAI explains that the cache stores key-value (KV) tensors, not the tokens themselves, and that reuse requires the entire rendered prefix to match. Anthropic defines its prefix as tools, then system, then messages, up to the block marked for caching.
The consequence is the same everywhere: put stable content first and anything that changes per request last. This is a context engineering concern as much as a billing one.
Anthropic, OpenAI and Gemini side by side
| Anthropic | OpenAI | Gemini | |
|---|---|---|---|
| Switched on by | Anthropic offers automatic caching with one top-level cache_control field, or explicit breakpoints on blocks | OpenAI enables it by default for supported models | Google enables implicit caching by default for Gemini 2.5 and newer |
| Default lifetime | 5 minutes, refreshed on each use; 1 hour optional | 30 minutes on GPT-5.6 and later; 12 hours optional in the Responses API | Not stated for implicit caching |
| Write charge | 1.25x base input (5 minutes), 2x (1 hour) | 1.25x (30 minutes), 2.5x (12 hours) on GPT-5.6 and later; none on GPT-5.5 and earlier | No write charge on implicit caching |
| Read charge | 0.1x base input on most models; 0.05x on Opus 5.5 and Sonnet 5.5 | 0.1x on most GPT-5.6 and later models; 0.05x on four GPT-6 models | Discounted automatically on a hit |
| Minimum prefix | 512 tokens on current models; 4,096 on Opus 4.6, Opus 4.5 and Haiku 4.5 | 1,024 visible input tokens on GPT-5.6 and later | 4,096 on Gemini 4 and 3.x models; 2,048 on Gemini 2.5 |
| Where hits show | cache_read_input_tokens | Cached-token usage fields | usage.total_cached_tokens |
The multipliers come from each provider’s docs, read in November 2026. Anthropic lists 0.025x reads on its Fable and Mythos 5.1 and 5.2 models, and OpenAI names the 0.05x models as GPT-6.2 Astra, GPT-6.2 Sol, GPT-6.1 Sol and GPT-6.1 Terra. The minimum for a given model is on the provider’s page, so check it for the exact model you call.
What the savings look like
Caching pays back after the first reuse when the write costs 1.25x. OpenAI works through the case at a 0.1x read rate: one write and nine full reads cost 2.15x the ordinary input cost, against 10x without caching.
Prices change often, so date them. On November 29, 2026, Anthropic listed Claude Sonnet 5.5 at $2 per million input tokens and $0.10 per million for cache hits. Google lists Gemini 4 Carbon input at $2.00 per million tokens and caching at $0.10 through November 30, 2026, rising to $4.00 and $0.20 from December 1, 2026. Anthropic also says these multipliers stack with the Batch API discount, long context pricing and data residency.
Why a cache misses
- A change inside the prefix. OpenAI lists the settings that can change the rendered prefix:
model,tools,parallel_tool_calls,text.format,reasoning.effort,text.verbosityand compaction. Compaction replaces earlier conversation content, so it can prevent reuse from the first changed token onward. - A varying block before the breakpoint. Anthropic gives the example of a timestamp near the top of a prompt: every request writes a new cache entry and never reads one. Its advice is to place the breakpoint at the end of the static prefix.
- A prompt below the minimum. Anthropic states that shorter prompts are processed without caching and no error is returned. If both cache creation and cache read fields are 0, the prompt was not cached.
- Too long a gap. Anthropic measures the 5-minute lifetime from the start of the request that wrote or read the entry, so a slow response eats into it.
- A long conversation. Anthropic documents a 20-block lookback window, so a breakpoint pushed 20 or more blocks past the last write misses unless you add a second breakpoint.
- Small agent turns on Gemini 4. Google says Gemini caches the full previous request only if the new request adds at least 2,050 tokens. Otherwise it re-processes the last 2,050 tokens at the standard input rate.
Explicit and implicit caching
Anthropic and OpenAI (GPT-5.6 and later) let you set breakpoints yourself. Google notes that explicit caching, where you create and manage cache objects, is not supported for Gemini 4 models or in the Interactions API, but still works on supported Gemini 3 and 2.5 models through generateContent. Explicit Gemini caching has a storage price per million tokens per hour, which appears on the pricing page for models such as Gemini 3.8 Flash.
Limits and privacy
OpenAI says cached input tokens still count toward tokens-per-minute limits, that caches are not shared across organizations, and that cached KV tensors have a maximum retention of 24 hours and are compatible with Zero Data Retention. On models before GPT-5.6, a stable prompt_cache_key helps route related requests to the same cache; on GPT-5.6 and later routing is automatic.
To confirm caching works, read the cached-token fields in each response. Logging them on every model call, for example as span attributes in LLM tracing, shows the hit rate over time. Anthropic warns that modifying tool definitions invalidates the entire cache, so keep tool calling definitions stable between calls.