Claude Prompt Cache Not Hitting
You added cache_control but cache_read_input_tokens stays at zero. Root causes: content before the breakpoint under 1024 tokens (Sonnet/Opus) or 2048 (Haiku), breakpoint not on cacheable content type, or upstream content changed invalidating cache.
Cache breakpoints only work if the content before AND including the breakpoint is at least 1024 tokens (Sonnet/Opus) or 2048 (Haiku). Put breakpoints at the end of stable, long content: system prompt, tools, or repeated document. Verify with usage.cache_read_input_tokens > 0 on the second request.
The Symptoms You're Seeing
Response usage always shows: cache_creation_input_tokens: 5423 cache_read_input_tokens: 0 → Cache is being WRITTEN every time, never read Or: cache_creation_input_tokens: 0 cache_read_input_tokens: 0 → Cache breakpoint ignored — likely under minimum tokens Costs match non-cached baseline → No cache hits happening at all Only sometimes hits, unpredictable → Cache TTL expiring OR upstream content varies subtly extra_headers not set: → prompt-caching beta header missing (older SDKs)
Minimum Token Requirements
| Model | Minimum tokens before/at breakpoint |
|---|---|
| Claude Opus 4.6 | 1024 |
| Claude Sonnet 4.5 | 1024 |
| Claude Haiku 4.5 | 2048 |
The cumulative content from the start of your prompt up to and including the breakpoint must meet the minimum. Content AFTER the breakpoint doesn't count toward that budget.
What Actually Causes Cache Misses
Fixes That Work (Tested Nov 2026)
1Verify Content Meets Minimum Tokens
2Correct Breakpoint Placement
Cache matches by exact prefix. If ANY byte before or at the breakpoint differs from a previous request, it's a miss. Put breakpoints AFTER stable content, BEFORE varying content. System prompt + tools + document = cache. User question + timestamp = don't cache.
3Verify Cache Hits After First Request
Preventing This Error Going Forward
- Count tokens before adding cache_control. Free API call, prevents wasted overhead.
- Freeze content before breakpoint. No timestamps, session IDs, or user data.
- Place breakpoints at natural stable/varying boundaries. After system, tools, docs.
- Log cache stats on every response. Catch regressions fast.
- Keep TTL in mind. 5min ephemeral won't help low-frequency workloads. Use 1hr beta.
Researcher · AI Error Hub
Frequently Asked Questions
Haiku's cost per token is much lower, so the overhead of managing a cache entry needs a larger prefix to be worthwhile. Anthropic sets the floor higher to prevent cache thrashing on tiny prompts.
Yes, put cache_control on the last tool. But total tools + preceding content must still meet 1024 tokens. Small tool definitions won't hit the floor alone.
No, cache is scoped per organization + API key + model. Different keys = different caches even for identical content.
Not guaranteed but very reliable within TTL. Cache eviction can happen under high memory pressure. In practice, hit rates are >99% for content sent within the 5-minute window.
Yes, cache_creation_input_tokens billed at 1.25× input rate ($3.75/M for Sonnet vs $3.00/M input). Break-even after 2 uses. 10 uses = 87% savings vs no cache.
Related Errors
Master Claude Prompt Caching
Weekly deep dives on caching strategies, cost optimization, and cache hit rates. 12,000+ developers subscribe.
Subscribe Free →