Concept guide · How AI works
Why asking an AI the same thing twice can be cheaper.
A model re-reads your whole instruction every time you send it. If the start of the request is identical to last time, the provider can reuse the work it already did on that part instead of charging you to read it again. That reuse is called prompt caching.
What it actually is
Anthropic's documentation says caching a repeated prefix "significantly reduces processing time and costs for repetitive tasks or prompts with consistent elements." The order is the catch. The docs state that "the cache follows the hierarchy: tools, then system, then messages. Changes at each level invalidate that level and all subsequent levels."
In plain terms: the fixed instructions and reference material near the top can be reused, but edit something near the top and everything after it has to be paid for and read again.
A normal example
You run a support assistant with a long fixed block: your tone, your refund policy and two example replies. The only thing that changes each time is the customer's message. Put the fixed block first and the customer's message last, and the fixed block is the same on every request, so it can be reused.
The proof: run the same prefix twice
On the API (the direct software connection to a model, the layer beneath a chat app) you can see this directly. A response splits the input it read into three counts: fresh input tokens, tokens written into the cache, and tokens read back from the cache. The first call writes the cache. A second identical call reads it back, so the reused part shows up as a cache read rather than a full charge.
Try it now
- Take a task you run often with a long fixed instruction.
- Send it twice completely unchanged and note the cost or speed of each.
- Now change one word right at the top and send it a third time.
The decision this gives you
Structure any reusable prompt so the stable material comes first, in the order tools, then system instructions, then the conversation, and the thing that changes each time comes last. That single ordering choice is most of the saving.
Putting today's date, a timestamp or the customer's changing message at the top of a reusable instruction. Anything that changes near the front invalidates the cache on every request, so you pay full price and never get the saving.
The human bit
Caching changes what you pay, not whether the answer is right. The documentation is blunt about it: a cached prefix "still occupies the context window," and caching "changes what you pay for those tokens, not whether they count." A cheaper repeat still needs the same check as the first one.
Where this stops being exact
Cache lifetimes and rules differ by provider. Anthropic's cache has "a 5-minute lifetime" by default, with "a 1-hour cache duration at additional cost," and a minimum length before anything is cached at all, for example 1,024 tokens on Claude Sonnet 5. Most of this is a developer concern. In a normal chat app it happens invisibly, and the ordering habit is what carries over.
Official source
The cache lengths and lifetimes above were checked against Anthropic's documentation on 19 August 2026.