Fix Claude Prompt Caching Misses (cache_read_input_tokens = 0)

Why Claude prompt caching returns 0 cached tokens—check prefix instability, 5-minute TTL expiry, protocol conversion, and route quality.

CACHE 0%Anthropiccache_read_input_tokens: 0 / Prompt caching not hitting on long context

Root Causes

Common Triggers

  • Dynamic timestamps or request IDs inside the system prompt break exact prefix matching
  • Using OpenAI-compatible translation instead of native /v1/messages stripped cache_control blocks
  • Gap between turns exceeded the 5-minute cache TTL
  • Low-quality proxy pools rotate upstream accounts on every turn, preventing cache hits

Long-Term Stability Path

Brioi actively monitors per-route cache hit ratios and streaming usage integrity so long-context coding sessions keep high cache efficiency.

Step-by-Step Fix

  • Step 1 · Use native /v1/messages protocolEnsure cache_control markers pass through untouched rather than converting to OpenAI chat format.
  • Step 2 · Keep system prompts & tool schemas deterministicMove dynamic timestamps into the latest user message so the cached prefix stays identical.
  • Step 3 · Verify cache_read_input_tokens on turn 2Run a two-turn test within 60 seconds and inspect the returned usage object.

Working Reference Snippet

Anthropic · CACHE 0%
// 检查第二轮响应里的 usage 字段:
{
  "usage": {
    "input_tokens": 142,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 48210,
    "output_tokens": 512
  }
}

FAQ

How much does prompt caching affect Claude Code spend?

Agentic coding resends massive repo context on every turn—losing cache hits can multiply your effective bill several times over.

More Troubleshooting Guides