Prompt caching stores the model's computation over a repeated prompt prefix so a later request sharing that prefix skips recomputing it. A cache write costs more than a normal request; a cache hit is billed at a steep discount. It only works when the shared content sits first in the prompt, before anything that changes per request.
Read the script
This is a spoken summary of the guide to how prompt caching really affects cost.
The short answer. Prompt caching stores the model's computation over a repeated prompt prefix, so a later request sharing that prefix skips recomputing it. A cache write costs more than a normal request. A cache hit is billed at a steep discount. And it only works when the shared content sits first in the prompt, before anything that changes per request.
The key points. What's cached is computed state, not response text. Writes cost more and reads cost less than a normal uncached request, but the discount shows up only on a hit, not on the request that first fills the cache. Prefix order is the whole mechanism, because only byte identical content from the start of the prompt can be reused. Cache lifetimes are short and provider specific, typically minutes, refreshed on each hit. And caching helps most with a large, stable prefix reused often: long system instructions, a big reference document, or a large tool definition block sent on every call.
What actually gets cached. A transformer builds an internal representation as it reads tokens in order. Caching stores that representation for an exact prefix, from the start of the prompt up to some cut point. It isn't caching the eventual response. Two requests with the same cached prefix but different final questions still get different, freshly generated answers. Only the shared prefix's processing is skipped.
Why a write costs more. Populating the cache means doing the computation and then storing the result, which is extra work compared with computing and discarding. Providers price this as a premium on cache write tokens. The payoff comes later, when a cache read token is billed at a steep discount versus standard input. The economics only work if the prefix is reused enough for the read discounts to outweigh the write premium.
So there are three kinds of token. A cache write, where the prefix is computed and stored, at a premium. A cache read, where the identical prefix is found and computation skipped, at a steep discount. And standard input, outside any cached prefix, at the baseline rate.
A single request never saves money. The first request pays the write premium and gets nothing back. Savings appear on the second and later requests that hit the stored prefix. A workload that never repeats a prefix gains nothing and pays slightly more for trying.
Why order decides everything. Caching works on a literal prefix match, so only content that stays fixed and sits at the very start can be served from cache. A common mistake is putting the user's changing question first and the static instructions after it, which guarantees a miss every time. Put stable material first, the system prompt, tool definitions and large reference documents, and variable content last.
What's established. That cache reads are billed at a discount, and that prefix order decides whether a hit is possible, are documented in providers' pricing pages and descriptions. That caching always reduces cost is unsupported, since a workload with no repeated prefix pays the premium for nothing. And that cached prompts stay available indefinitely is also unsupported, because lifetimes are short.
A stable tool list is a typical cacheable prefix, and its size is measured in the M C P probe write-up linked on the page.
Key takeaways
- What's cached is computed state, not response text — the model's internal representation of having processed a specific prefix, reused instead of recomputed.
- Cache writes cost more, cache reads cost less than a normal (uncached) request — the discount only shows up on a hit, not on the request that first populates the cache.
- Prefix order is the whole mechanism. Only content that's byte-identical from the start of the prompt can be reused, so static content has to come before anything that varies per request.
- Cache lifetimes are short and provider-specific — typically minutes, refreshed on each hit — not a persistent store you can rely on across sporadic requests.
- Caching helps most with a large, stable prefix reused often: long system instructions, a big reference document, or a large tool-definition block sent on every call in a session.
Three kinds of token in a cached request, and what each costs
Prefix computed and stored for the first time
Identical prefix found in cache, computation skipped
Not part of any cached prefix, processed normally
What actually gets cached
A transformer model processes a prompt by building up an internal representation as it reads through the tokens in order. Prompt caching stores that intermediate representation for a specific prefix — the exact sequence of tokens from the start of the prompt up to some cut point — so that a later request sharing the identical prefix can reuse the stored computation instead of redoing it. It is not caching the model's eventual response; two requests with the same cached prefix but different final questions still get two different, freshly-generated answers. Only the shared prefix's processing is skipped.
Why a cache write costs more than a normal request
Populating the cache means doing the prefix's computation and then storing the result somewhere retrievable — extra work compared to a normal request that computes and discards. Providers price this as a premium on cache-write tokens relative to standard input token pricing. The payoff comes later: a cache-read token, on a subsequent request that hits the same stored prefix, is billed at a steep discount versus a standard input token, because the actual computation is skipped entirely. The economics only work out if the prefix gets reused enough times that the read discounts outweigh the initial write premium.
| Token category | What happened | Relative cost |
|---|---|---|
| Cache write | Prefix computed and stored for the first time | Premium over standard input |
| Cache read (hit) | Identical prefix found in cache, computation skipped | Steep discount vs. standard input |
| Standard input | Not part of any cached prefix, processed normally | Baseline rate |
Why prompt order decides whether caching helps
Because caching works on a literal, byte-identical prefix match, only content that stays fixed across requests and sits at the very start of the prompt can ever be served from cache. A common mistake is putting the user's specific, ever-changing question first and static system instructions or reference material after it — that ordering guarantees a cache miss on every request, because the "prefix" up to any point includes the part that changed. Putting the stable material first — system prompt, tool definitions, a large reference document — and the variable, per-request content last is what actually makes a hit possible.
Documented vs. inferred vs. unsupported
| Claim | Status | Basis |
|---|---|---|
| Cache-read tokens are billed at a discount vs. standard input tokens | Documented | Published directly in major LLM providers' API pricing pages |
| Prefix order determines whether a cache hit is possible | Documented | Follows directly from how prefix-based caching is described in provider documentation |
| Caching always reduces total cost for any workload | Unsupported | A workload with no repeated prefixes pays the write premium with no offsetting reads — the net effect depends on reuse pattern, not a universal win |
| Cached prompts stay available indefinitely once written | Unsupported | Published cache lifetimes are short and provider-specific, refreshed on each hit rather than persistent |
Sources and further reading
Primary documentation for the topics in this guide:
- Prompt caching — Anthropic docs
- Prompt caching — OpenAI docs