lowob

What Is Prompt Caching?

Prompt caching is a provider feature that stores the processed form of the fixed start of a prompt, such as instructions, tool definitions or a long document, so later requests that begin the same way skip that work. Cached input is billed at a fraction of the normal rate and the response starts sooner. The answer itself is unchanged. It only works if the repeated part comes first and stays identical, so prompt design decides whether a team gets the saving.

Gateway 0ToolingContextRecordReasoningGateway 1Gateway 2Gateway 3
Where this piece sits in The Build Order: the context layer.

What prompt caching means

Before a model writes anything, it processes every input token. A request that opens with 20,000 tokens of policy repeats that work, and that charge, on every call.

Prompt caching keeps the result of that processing for a short period. Research came first: Gim and colleagues' 2023 paper "Prompt Cache" stored precomputed attention states for frequently reused text segments on the inference server. They reported time-to-first-token improvements of about 8 times on GPUs and 60 times on CPUs, with output accuracy preserved.

Providers now offer caching as a billing feature, and the mechanics differ.

AnthropicOpenAIGoogle Gemini API
How it is turned onA cache breakpoint on a block, or one top-level setting for automatic cachingOn by default for supported modelsImplicit caching on by default for Gemini 2.5 and newer
Minimum prompt size512 to 4,096 tokens, by model1,024 tokens on recent models2,048 to 4,096 tokens, by model
How long it lasts5 minutes, refreshed on each use; 1-hour optionTypically 5 to 10 minutes of inactivity, up to an hour; extended retention up to 24 hoursNot stated for implicit caching
Price of a hit0.1 times input on most models, lower on someDiscounted up to 95%Savings passed on automatically
What must matchEverything up to the breakpointThe entire rendered prefixGoogle advises common content first, with similar requests sent close together

Anthropic's documentation states that caching "has no effect on output token generation": the response is the same as it would be without the cache.

Why it matters for a commercial team

Most commercial AI work has a large fixed part and a small variable part. A proposal checker carries the same pricing rules and discount policy on every call; only the proposal changes. An account assistant carries the same system prompt and tool definitions; only the question changes. An agent re-sends its instructions and tools at every step of its loop. The fixed part is where caching pays.

A worked example, illustrative, using Anthropic's list prices for Claude Sonnet 5.5 on 16 November 2026: $2 per million input tokens, $2.50 for a five-minute cache write and $0.10 for a cache read. A 20,000-token policy prefix is sent 100 times in a session, with no gap longer than five minutes. Uncached, that prefix costs $4.00. Cached, one write costs $0.05 and 99 reads cost about $0.20, so about $0.25 in total, or roughly 94% less. Output and the variable part are billed as normal. See AI inference cost for the other levers.

Speed improves too: Anthropic says caching generally improves time-to-first-token for long documents, and OpenAI that it reduces input processing time before the response starts.

Caching also rewards a discipline lowob recommends anyway: stable, versioned instructions. A system prompt edited ad hoc during the day, or a timestamp placed at the top of every prompt, breaks the cache on every call. Anthropic's documentation states that "changes at each level invalidate that level and all subsequent levels". Editing a tool definition, for example, invalidates the tools, system and message caches together.

On privacy, Anthropic says caches "are isolated between organizations", and on its own API also by workspace. OpenAI says caches "are not shared across organizations". Cached content is still held for the cache lifetime, so firms with zero data retention terms should confirm how caching is treated under them.

Prompt caching is different from response caching, which some LLM gateways offer. A response cache returns a stored answer to an identical request without calling the model. A prompt cache still calls the model.

How to design for caching

DoAvoid
Put fixed material first: tools, system prompt, policies, reference documentsDates, user names or request IDs at the top of the prompt
Put the variable question or record lastReordering tool definitions between calls
Version system prompts and change them deliberatelySmall edits to live instructions during the day
Check the usage fields: cache_read_input_tokens at Anthropic, cached_tokens at OpenAIAssuming caching worked because it is switched on
Send related calls close togetherSpacing calls so the cache expires between them

lowob takeaways

  • Caching reuses the fixed start of a prompt. Input gets cheaper and faster; the answer is unchanged.
  • Order decides the saving. Fixed material first, variable material last.
  • Any change to the prefix breaks it. Version instructions and tools.
  • Verify in the usage fields. Track cache hits per task.

Common questions

Does prompt caching change the AI model's answer?

No. Anthropic's documentation states the response is identical to what you would get without caching. Only the cost and speed of processing the input change.

How long does a prompt cache last?

Minutes, typically. Anthropic's default is five minutes, refreshed on each use, with a one-hour option. OpenAI's caches typically last 5 to 10 minutes of inactivity, up to an hour, with extended retention of up to 24 hours.

Is prompt caching the same as caching AI responses?

No. Response caching returns a stored answer without calling the model. Prompt caching still calls the model and generates a new answer; it only reuses the processing of the prompt's opening.

Can other customers see my cached prompts?

Anthropic and OpenAI both state that caches are isolated between organisations, even when prompts are identical.

Sources and notes

What Is an AI Agent, and Where Does It Fit in the Brain?

Read next in The Build Order