Prompt caching lets a model provider skip reprocessing a portion of your prompt that it has already seen in a recent prior call, billing that reused portion at a reduced rate instead of the full input-token price. For applications that send a similar large prefix — a system prompt, a reference document, a tool schema list — on every request, this can meaningfully cut both cost and latency, since the provider does not need to run the full attention computation over that prefix again from scratch.
What changed in 2026
- Prompt caching spread from a single provider's feature to a near-universal one, with most major API providers now offering some form of cached-prefix discount, though exact mechanics and pricing differ.
- Cache duration and eviction policies became a real design constraint. Caches typically expire after a short window of inactivity, meaning bursty or low-frequency traffic patterns benefit less than steady, high-frequency traffic.
- Automatic caching (no explicit cache-write step required) became more common, lowering the implementation barrier compared to earlier designs that required manually marking cache breakpoints.
- Caching interacted with new reasoning-token billing. For reasoning models, cached prefixes can reduce input cost while reasoning tokens remain billed separately, so total savings are often smaller than input-only figures suggest.
How prompt caching actually works
A prompt is processed by the model as a sequence of tokens, and internally, computing the attention representations for those tokens is the expensive part of inference. If two consecutive calls share an identical leading sequence of tokens, the provider can reuse the previously computed representations for that shared prefix instead of recomputing them, and typically bills that reused portion at a lower per-token rate than a fresh call.
The critical constraint: caching applies to a prefix, and the match generally needs to be exact from the start of the prompt up to the point where content diverges. If your system prompt is followed immediately by variable user input, only the system prompt portion caches — as expected — but if you insert even a single variable token before a supposedly stable block, that block loses its cache eligibility for that call.
Structuring prompts to benefit from caching
| Structure |
Cacheable? |
Notes |
| System prompt, then user input |
System prompt caches |
Simple, most common pattern |
| System prompt, then reference doc, then user input |
System prompt and doc cache |
Good for RAG-style apps with a stable knowledge slice |
| User input, then system prompt |
Nothing caches |
Variable content placed first breaks caching for everything after it |
| System prompt with a timestamp or session ID embedded |
Nothing caches |
Any variation in the "stable" portion defeats the cache |
| Long conversation history, growing each turn |
Only the portion prior to the newest turn caches, if unchanged |
Works well for multi-turn chat if earlier turns are not edited |
The practical rule: put everything that does not change between calls first, and everything that does change last.
Where caching pays off most
High-frequency, repeated-prefix workloads see the largest benefit — a customer support bot reusing the same lengthy system prompt and knowledge snippets across thousands of daily conversations, or a coding agent reusing the same large tool-schema list on every step of a multi-step task. Low-frequency or highly variable-prefix workloads see little to no benefit, since caches typically expire after a period of inactivity and a prefix that changes on every call never has anything to reuse.
Common mistakes
Putting variable content before stable content. This is the single most common way to accidentally defeat caching — even a tiny piece of per-request variation placed early in the prompt breaks the cache for everything after it.
Assuming caching is free. Writing to a cache (the first call with a new prefix) is often not discounted, and reads have their own pricing tier — check current provider pricing rather than assuming savings apply uniformly.
Not accounting for cache expiration in cost projections. Bursty traffic with long gaps between calls may see caches expire between requests, reducing real-world savings below the theoretical best case.
FAQ
Does prompt caching change the model's output?
No, in principle it should return equivalent results — caching is a cost and latency optimization, not a change to what the model computes, though minor nondeterminism can exist independent of caching.
How long does a cached prefix stay valid?
It varies by provider and is typically a short window measured in minutes, refreshed by continued use. Check current documentation for exact figures.
Do I need to do anything special to enable caching?
Increasingly no — several providers now cache eligible prefixes automatically. Some still require explicitly marking a cache breakpoint in the request. Check your provider's current API.
Is prompt caching the same as a vector database cache?
No. Prompt caching reuses model-side computation for a repeated prompt prefix. A vector database is a separate retrieval system for finding relevant content in the first place — the two are complementary, not substitutes.
Where to go next