Is your Claude prompt caching working? A 10 second check
One changing line at the top of your prompt can make every call write the cache and never read it.
Published here · 2 sources · Resume reading
You turned on prompt caching and the bill did not move. One changing line at the top of your prompt can make every call write the cache and never read it.
The 10 second check
- Send the exact same request twice, within 5 minutes (the default cache lifetime).
- On the second response, read two fields in
usage:cache_creation_input_tokensandcache_read_input_tokens.
What the second response tells you
| Result | Meaning |
|---|---|
cache_read_input_tokens above 0 | Caching works |
| Both 0 | Not cached, most likely under the minimum length |
cache_creation_input_tokens above 0 again, read 0 | Something at or before your cache_control block changed (a timestamp, a user name, the incoming message). Move it after the cached block |
Minimum token counts
From the docs, checked November 9 [1]:
| Model | Minimum tokens |
|---|---|
| Claude Sonnet 5.5 | 512 |
| Claude Sonnet 5 | 1,024 |
| Claude Haiku 4.5 | 4,096 |
Every other model is in the table on the docs page.
Check a saved response
jq -r '.usage | if .cache_read_input_tokens > 0 then "HIT" elif .cache_creation_input_tokens > 0 then "MISS: wrote again" else "NOT CACHED" end' response.jsonWhy the second case hurts
A 5 minute cache write is billed at 1.25x the base input price [2]. A write that never gets read costs more than no caching at all.
To compare what a cached read costs on another model, see Amazon Ergo vs Opus 5.5 on price and long tasks.
Send this to the friend who turned on Claude prompt caching and saw the bill stay the same.
Keep this guide
Filed under AI agents, Cost and context
Questions about this guide
Why does a cache write that never gets read cost more?
A 5 minute cache write is billed at 1.25x the base input price. If it never gets read, you paid extra for nothing.
Where do the fields appear in streaming?
The same fields arrive in the message_start event.
Sources
- Claude docs: prompt cachingplatform.claude.com
- Claude docs: pricingplatform.claude.com