Logo
FrontierNews.ai

Why Your Claude AI Sessions Keep Burning Through Tokens (And How to Stop It)

Claude's prompt caching system works like a smart memory that reuses expensive computations, but five common actions quietly throw that memory away and force the model to start over from scratch. Anthropic published a detailed breakdown of how token billing actually works, revealing that most developers are unknowingly triggering full cache resets mid-conversation by switching models, toggling effort levels, or enabling fast mode.

What's Actually Costing You Money in Claude Sessions?

The real expense in Claude conversations isn't about using fewer tokens overall; it's about making sure the tokens you do use go toward what you actually asked for. Output tokens are roughly five times more expensive than input tokens, while cached input costs only about one-tenth of normal input pricing. This pricing structure exists because of how large language models (LLMs) actually work under the hood. Input tokens go through a single pass called prefill, where the model processes your system prompt, conversation history, and current message all at once. Output tokens, by contrast, go through decode, generating one token at a time sequentially. A 200-token response requires 200 separate passes through the model, which is why output is priced so much higher.

Understanding this mechanism changes how developers should think about efficiency. Reading a large file into a conversation is relatively cheap because it's input. But thinking about that file repeatedly at high effort levels is expensive because each thought requires sequential output generation.

Which Five Actions Bust Your Cache and Reset Your Bill?

Prompt caching works by storing the computational state of tokens the model has already processed. If a new request starts with exactly the same tokens as a previous one, the server can load that cached state instead of recomputing it from scratch. The critical detail is that the match must run from the very beginning of the request forward. Claude Code always sends requests in the same order: tool definitions, system prompt, conversation history with CLAUDE.md at the front, and then any new messages. Anything that changes this order or the cache key throws away everything behind it.

  • Switching Models: Every model has its own separate cache. Switching from Claude Opus to Claude Sonnet or Claude Haiku forces the entire conversation to re-prefill at full price, including the opusplan feature which switches models every time you enter or leave plan mode.
  • Changing Effort Level: Effort level is part of the cache key, so adjusting it mid-conversation triggers a full re-prefill at the same cost as switching models.
  • Enabling Fast Mode: Fast mode is also part of the cache key, and turning it on mid-conversation causes re-prefilling at fast mode prices. Turning it off is free, but turning it on is not.
  • Using /compact Command: The /compact command rewrites your entire conversation into a summary, so nothing in the old conversation matches the cache anymore. The system prompt survives, but everything else is lost.
  • Time Expiration: Cache expires after one hour on a subscription or five minutes on an API key, though the ENABLE_PROMPT_CACHING_1H flag can raise the API key expiry to one hour. Every turn resets the clock, so actively used sessions never age out.

How to Optimize Your Claude Sessions and Reduce Token Waste

  • Use /clear Between Tasks: The single most effective and cheapest action you can take is running /clear between different tasks. This resets the conversation without the expensive re-prefilling that happens when you switch models or effort levels mid-session.
  • Use /rewind Instead of /compact: When you want to undo the last few turns, use /rewind, which cuts turns off the end while keeping everything before them cached and untouched. /compact rewrites the entire conversation, so nothing matches anymore and it always costs something. Reserve /compact for when an earlier task is genuinely done, not for undoing a wrong turn.
  • Compact Before Breaks, Not After: If you do need to use /compact, do it while the old conversation is still in cache and before you step away from the keyboard. Summarizing is cheap while the cache is fresh but expensive once it has expired, which is why compacting after returning to a cold session an hour later wastes money.
  • Switch Models at Session Start: If you're weighing which model and effort level to use, make that decision at the beginning of a session or right after a /clear command. Never switch mid-conversation if you can help it.
  • Manage Command Output Carefully: Output over 30,000 characters is fine because Claude Code writes it to a file and puts only a short preview plus the path into the conversation. The real problem is everything under that limit. A test runner printing 400 passing tests one line at a time stays under the cap, but those 400 lines become part of every remaining turn and occupy context the model has to reason around.

Does Cache Expiry Work the Same Way for All Claude Models?

The one-hour cache expiry is not a model property at all; it's a function of how you're billed. Subscription users get one hour of cache retention, while API key users get five minutes, though the ENABLE_PROMPT_CACHING_1H environment variable can extend the API key case to one hour. The model you're running doesn't change the cache duration, though it does change the cache itself since each model maintains its own separate cache. Every turn resets the expiry clock, so an actively used session never ages out. The expiry only becomes a problem during breaks, and resuming an old session almost always requires re-prefilling because the cache is usually gone by then.

The most immediately actionable insight from Anthropic's breakdown is that resumption is never free. Understanding the billing mechanism automatically explains why people argue about these rules and why the practical advice falls out of the system naturally. Being efficient with tokens doesn't mean using fewer of them overall; it means making sure the ones you do use go toward the thing you actually asked for.