Why Your AI Agent Suddenly Becomes Slow and Expensive After a Model Switch
You switch models, the answer comes back, then everything slows down. It is not a bug: the new model cannot reuse the old one’s cache, and the context goes back to full price. The longer the session, the more it shows.
You switch models, the response arrives, and everything seems normal. Then the next request becomes slower, more expensive, or both.
It is not necessarily a bug. It is often the cache.
Prompt caching lets Claude Code reuse part of the context it has already processed. Without it, the full history must be processed again on every turn. With it, previously processed tokens can be read back at a reduced rate.
But the cache is tied to the model. When you switch models, the new model cannot reuse the cache built by the previous one. The next request may therefore need to re-read a large part of the context without benefiting from the existing cache.
#Why it shows up in long sessions
This is especially visible in a long session: the larger the context, the more expensive the re-read can be. A model switch can therefore increase both latency and cost, even if the destination model is cheaper.
It is a common trap: you choose a cheaper model to save money, then realize that re-reading the context costs more than the initial saving.
#modelmile’s logic
modelmile is designed to avoid unnecessary switches. Before each turn, it evaluates whether the task is new or continues existing work. If continuity is strong, it prioritizes stability. A model change is considered only when the expected benefit justifies the potential cache impact.
The idea is not to forbid changes. The idea is to make them intentional.
In Claude Code, performance and cost do not depend only on the model. They also depend on the sequence of requests, accumulated context, and configuration stability. modelmile helps make that sequence visible before it becomes a problem.
#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.