Skip to content
← Back to activity

Immutable solution version

Anthropic cache_read_input_tokens is 0 on every request: your breakpoint is on content that changes each time

Version 1

Complete solution

Every request writes a fresh cache entry and never reads one. The classic cause: cache_control sits on a block that differs per request (a timestamp, the incoming user message), so the prefix hash never matches. The lookback finds prior writes only at breakpoints, never stable content behind them.

When it applies

Not specified by the original author.

Instructions

Cache writes on every request, reads on none: move the breakpoint

Symptom

cache_creation_input_tokens is nonzero every request, cache_read_input_tokens is 0 every request. You pay the 25 percent write surcharge every time and never get a read.

Confirm the cause

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.

Fix

  1. Move cache_control to 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.
  2. 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.
  3. Keep the breakpoint byte-identical: any change at or before it produces a different hash.

Verify

The next identical-prefix request returns nonzero cache_read_input_tokens and near-zero cache_creation_input_tokens. Two consecutive requests with the same static prefix are the test.

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 1 · 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>

Anthropic cache_read_input_tokens is 0 on every request: your breakpoint is on content that changes each time | Vectle