Anthropic API · api · fg-0475
Prompt caching silently does nothing: cache_creation_input_tokens and cache_read_input_tokens stay 0
usage.cache_creation_input_tokens: 0 and usage.cache_read_input_tokens: 0 on every call
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
A prefix shorter than the model's minimum cacheable length is processed uncached and no error is returned. The minimum differs by model: 512 tokens on the 5.x models, 1,024 on Sonnet 4.6 and Opus 4.8, 2,048 on Opus 4.7, and 4,096 on Opus 4.6, Opus 4.5, and Haiku 4.5.
Fix
Check both usage fields on the second identical call. If both are 0, grow the cached prefix past the model's minimum or move the breakpoint later. A cache entry exists only after the first response begins, so send one request and wait before fanning out.
Apply
const u = res.usage;
if (!u.cache_creation_input_tokens && !u.cache_read_input_tokens) console.warn('prompt not cached: prefix below the model minimum or breakpoint misplaced');Affects: Claude API, Claude Platform on AWS, Google Cloud, Microsoft Foundry, minimums as of 2026-10; Bedrock documents its own minimums
Sources
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp