Claude prompt caching: get the cache-read discount, and check you actually got it
The short version
Claude can store the start of your prompt: your tools, your system prompt, earlier messages. While it is stored, a request that starts with the same text reads it from the cache instead of processing it again. Those tokens cost a fraction of the normal input price: 0.1x on most models, 0.05x on Opus 5.5 and Sonnet 5.5.
The cache lives five minutes. Every time it is used, the five minutes start again, at no extra cost. The first call that writes it costs 1.25x, so it pays off on the second call: two calls cost 1.35x instead of 2x.
The catch: turning it on isn't the same as getting it. Change one word above the cache point and the next call is a full-price miss. There is no error and no warning; you only see it in the usage numbers.
| What | Detail |
|---|---|
| Turn it on | one top-level cache_control field |
| Lifetime | 5 minutes, reset on every hit (a 1-hour option costs 2x to write) |
| Write | 1.25x the normal input price |
| Read | 0.1x (0.05x on Opus 5.5 and Sonnet 5.5, 0.025x on Fable 5.1 and Mythos 5.1) |
| Check | cache_read_input_tokens in the response; 0 means full price |
Source: Anthropic docs, prompt caching (read 1 Nov 2026).
What it costs (per million input tokens)
| Model | Normal input | 5-minute write | Cache read |
|---|---|---|---|
| Claude Opus 5.5 | USD 4 | USD 5 | USD 0.20 (0.05x) |
| Claude Sonnet 5.5 | USD 2 | USD 2.50 | USD 0.10 (0.05x) |
| Claude Opus 5 / 4.8 | USD 5 | USD 6.25 | USD 0.50 (0.1x) |
| Claude Sonnet 5 | USD 2 | USD 2.50 | USD 0.20 (0.1x) |
| Claude Haiku 4.5 | USD 1 | USD 1.25 | USD 0.10 (0.1x) |
Copy these prompts
Paste these into Claude Code in the repo that calls the Claude API, in order.
1. Turn it on
Find every Claude API call in this codebase. Add one top-level field to each request: "cache_control": {"type": "ephemeral"}. Do not change anything else in the request. Show me the diff.
2. Put what never changes first
For each Claude API call, list everything that goes into tools, system and the first messages. Mark anything that changes per request: dates, times, user names, IDs, random ordering, edited tool lists. Move those to the end of the request, after the parts that never change, and build the fixed part once from a constant so it is identical on every call.
3. Check cache_read_input_tokens
Log usage.cache_creation_input_tokens, usage.cache_read_input_tokens and usage.input_tokens for every Claude API call. Then send the same request twice within five minutes and print both usage blocks. If cache_read_input_tokens is 0 on the second call, find what changed between the two requests and tell me.
The exact request
One cache_control line turns on automatic caching; the cache point moves to the last cacheable block as the conversation grows.
{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"cache_control": {"type": "ephemeral"},
"system": "<your long instructions that never change>",
"messages": [{"role": "user", "content": "<the part that changes>"}]
}
Then look at usage in the response. Call twice within five minutes; the second call should show a big number here:
"cache_creation_input_tokens": tokens written to the cache (billed at 1.25x)
"cache_read_input_tokens": tokens read from the cache (the discounted ones)
"input_tokens": tokens after the cache point, billed normally
Why it shows zero
| # | Cause | Fix |
|---|---|---|
| 1 | The prompt is too short. Minimum: 512 tokens on the 5.5 and Fable/Mythos 5 models, 1,024 on Sonnet 5, the Sonnet 4.x models and Opus 4.8, 2,048 on Opus 4.7, 4,096 on Opus 4.6/4.5 and Haiku 4.5 | Cache only long prefixes; short ones are skipped with no error |
| 2 | Something above the cache point changed: a timestamp or user name in the system prompt, edited tools, tool_choice, an added or removed image |
A hit needs the text up to the cache point to be 100 percent identical. Order is tools, then system, then messages: a change at one level breaks it and everything after |
| 3 | More than five minutes between calls | Use "ttl": "1h" for slow traffic |
| 4 | Parallel requests | A cache entry exists only once the first response starts: send one call, wait for it to begin, then the rest |
Steal this for your app
- Put what never changes first (tools, instructions, reference docs) and what changes last (the user's message, today's date).
- Build the cached prefix once from a constant so it stays byte-identical between calls.
- Log
cache_read_input_tokensnext to cost in your own dashboard so a silent miss shows up as a number. - Agents and chatbots that resend a long system prompt every turn gain the most.
Run this on your codebase
Paste this into Claude Code in the repo that calls the Claude API:
Find every place this codebase calls the Claude API. For each call: is prompt caching on (cache_control)? Is anything that changes per request (dates, user names, IDs, random ordering) placed before the cached part? Is the cached prefix at least the model's minimum length? Do we log cache_read_input_tokens? List the fixes in order of money saved, and show me the diff for the top one.