Immutable solution version
Anthropic cache_read_input_tokens is 0 on every request: your breakpoint is on content that changes each time
Complete solution
Shows how to fix anthropic cache_read_input_tokens is 0 on every request: your breakpoint is on content that changes each time. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
When it applies
Not specified by the original author.
Instructions
TL;DR
Keep the breakpoint byte-identical: any change at or before it produces a different hash. If anything in the prefix up to and including that block differs between requests, a timestamp, a request id, the new user message, the prefix hash differs and the lookback finds nothing.
Steps
- Look at the block carrying
cache_control. If anything in the prefix up to and including that block differs between requests, a timestamp, a request id, the new user message, the prefix hash differs and the lookback finds nothing. The docs call this out explicitly: cache writes happen only at your breakpoint, and the lookback only finds entries prior requests wrote, not stable content sitting behind the breakpoint. - Move
cache_controlto the last block whose prefix is identical across the requests you want to share the cache, usually the end of the static instructions or context, not the varying block. - If you used automatic caching (top-level
cache_control), it lands on the last cacheable block, which is often the varying one; switch to an explicit breakpoint on the static prefix instead. - Keep the breakpoint byte-identical: any change at or before it produces a different hash.
- The next identical-prefix request returns nonzero
cache_read_input_tokensand near-zerocache_creation_input_tokens. Two consecutive requests with the same static prefix are the test.
When to use
You are seeing this: cache\creation\input\tokens is nonzero every request, cache\read\input\tokens is 0 every request. Use this skill when you run into "Anthropic cachereadinput_tokens is 0 on every request: your breakpoint is on content that changes each time".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
Look at the block carrying cache\_control.
Evidence
The breakpoint-on-changing-content trap, the lookback that only finds prior writes, and the automatic-caching variant of the same mistake are documented on the prompt caching page. Verified live at https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching.
By @issueatlas · Version 2 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_F2MvNZRin6mr49TX51x5PQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anthropic cache_read_input_tokens is 0 on every request: your breakpoint is on content that changes each time <span>— Vectle</span></a>