Switching Models in Claude Code Can Break Your Cache
The prompt cache is tied to the model. Switching models mid-session throws it away, and the next turn rereads the whole context at full price. In a long session, the savings from the cheaper model can vanish right there.
Switching models in the middle of a Claude Code session may seem harmless. However, that simple change can have a significant impact on the prompt cache.
Prompt caching lets Claude Code reuse part of the context it has already processed. Without it, the full history would need to be processed again on every turn. With it, previously processed tokens can be read back at a lower rate.
But the cache is not universal: it is tied to the model being used. When you switch models, the new model cannot reuse the cache built by the previous one. The next request may therefore re-read a large part of the context without benefiting from the existing cache.
#Why it costs money
In a short session, the impact may seem limited. In a long session, with many files explored, decisions made, and context accumulated, the re-read can become expensive.
Every model switch can create a cache break. If you move from Opus to Sonnet for a simple task, return to Opus for the next task, then switch back to Sonnet, you create several cache breaks. Each break can lead to an expensive re-read of the context.
This does not mean you should never change models. It means a change should be justified.
#modelmile’s logic
modelmile is designed to avoid this kind of unnecessary switching. Before each turn, it evaluates task continuity. If you are working on the same refactor, bug, or feature, it prioritizes stability over a purely theoretical model change.
A switch is considered only when the expected benefit justifies the potential cache impact. The idea is not to lock your model. The idea is to make the decision conscious.
In Claude Code, cost does not depend only on the model you choose. It also depends on how you sequence requests, tools, and configuration changes. modelmile helps make that dimension visible before it becomes an unpleasant surprise.
#What this means for you
If you use Claude Code intensively, stability can be as important as model choice. A slightly more expensive but stable model can sometimes cost less than a cheaper model used intermittently.
modelmile does not promise guaranteed savings. It offers a more thoughtful approach: understand the cache impact, avoid unnecessary breaks, and make more consistent routing decisions.
The arithmetic
A message of 12,000 input tokens and 900 output tokens, without cache. Anthropic prices per million tokens. Cache writes are not counted.
Haiku 5.5 12,000 × 0.1 $ + 900 × 0.5 $ = $0.0017 Sonnet 5.5 12,000 × 2 $ + 900 × 10 $ = $0.0330 Opus 5.5 12,000 × 4 $ + 900 × 20 $ = $0.0660 Gap between the most and the least expensive message : $0.0644 (amounts per million tokens, divided by 10⁶ — an estimate, not an invoice)
An estimate, not an invoice.