← All posts
·4 min read

Claude prompt caching, explained

Most Claude requests repeat the same instructions and documents. Prompt caching bills that repeated part at a fraction of the price. Here is how it works.

This is Day 7 of Claude Architect in 30 Days, and the end of Week 1. Day 6 arranged each request with the stable parts first and the question last. Today is the payoff for that order: prompt caching, often the cheapest win available in a Claude system.

Who this is for: anyone running a Claude feature at volume who wants to cut its cost and response time without changing what it does.

Most requests repeat themselves

Look at the requests a typical feature sends. The system prompt is the same every time. The tool definitions are the same. Often a large document, such as a policy, a manual or a codebase summary, is the same too. Only the question at the end changes. Without caching, Claude processes all of it again on every call, and you pay full price for it every time.

How the cache matches

Caching works on the prefix: the request read from the start up to a point you mark. When a new request begins with exactly the same prefix as a recent one, Claude reuses the earlier work for that part and processes only what comes after it.

Requests are read in a fixed order: tools first, then the system prompt, then the messages. So the stable parts are naturally at the front, provided you keep them stable. You mark where the cacheable prefix ends with a cache_control setting on a block, or set it once at the top level of the request and let the API place it on the last block it can cache.

The numbers

From Anthropic's pricing page (November 2026), relative to the normal input price:

PriceNotes
5-minute cache write1.25×Pays for itself after one cache hit
1-hour cache write2×Pays for itself after two hits
Cache hit, Opus 5.5 and Sonnet 5.50.05×One twentieth of the input price
Cache hit, most other models0.1×

A cache entry lasts five minutes by default, and each hit refreshes it, so a feature with steady traffic keeps it warm. Cached prefixes are also faster to process, which shortens the wait before the answer starts.

What breaks it without an error

Because it's an exact prefix match, one changed character early in the request makes everything after it a miss. Nothing fails; the bill just stays high. The usual causes:

  • A timestamp or request ID in the system prompt.
  • Tools listed in a different order from one request to the next.
  • JSON whose keys come out in a different order each time.
  • Switching models. Each model has its own cache.

There's also a minimum size: a prefix shorter than a model-dependent minimum, between 512 and 4,096 tokens, isn't cached at all.

Check that it's working

Every response's usage field reports cache_creation_input_tokens (written to the cache on this call) and cache_read_input_tokens (served from it). On the second and later requests with the same prefix, the read count should be above zero. If it stays at zero, something in the prefix is changing; compare two requests byte for byte from the top. Caching sits alongside routing in cost-aware LLM engineering as one of the two biggest cost levers.

Try this today

Find the largest part of your requests that repeats. Move it to the front of the request, mark it for caching, then check the usage numbers on the next few calls. Week 2 starts tomorrow with Day 8: how Claude calls your functions. If your Claude bill is growing faster than your usage, that's a problem I help with in LLM and RAG systems.

Prefer slides? Download today's carousel as a PDF.

Shanker Dhand
Shanker Dhand
AI Engineer & Technical Lead

I design and ship production AI systems — RAG pipelines, agents, and evaluation infrastructure — built on 10+ years of full-stack engineering.

Related posts