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.
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
// 检查第二轮响应里的 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
Diagnose whether your OpenAI HTTP 429 is caused by exhausted credits or RPM/TPM throttling, with backoff code and multi-route failover options.
Resolve Anthropic 403 region blocks and proxy-triggered account suspensions when running Claude API or Claude Code.
Troubleshoot terminal proxy mismatches, TLS timeouts, and ECONNRESET drops in Claude Code CLI with a clean custom gateway setup.
Resolve Google AI Studio free-tier RPM caps and regional Vertex AI exhaustion causing 429 RESOURCE_EXHAUSTED errors.

