Claude Code cache miss costs 12.5x more, beware
Key point
When using Claude Code, certain actions can invalidate the prompt cache, causing costs to spike by 12.5x.
Details
Analyzing Anthropic's Prompt Caching pricing policy reveals that a Cache miss costs 12.5x more than a Cache hit. This is because cache write tokens cost 1.25x the base input, while cache read tokens cost 0.1x.
The cache is built in the order tools $\to$ system $\to$ messages, and changes at a higher level invalidate all caches below it. The main factors that invalidate the cache and raise costs during a Claude Code session are as follows.
- Installing or removing an MCP server: Adding or removing an MCP server mid-session changes the tool definitions (tools), invalidating the entire cache. It is more economical to install MCP servers in advance at the start of the session.
- Switching models (
/model): Since the cache is managed separately per model, changing the model mid-session means the existing cache cannot be used.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.