← all news

How to keep Claude Code sessions from running up the bill

AI · · · source (claude.com)

Anthropic published a practical guide to why two people can make the same fix in Claude Code and get very different bills. Unlike a flat-fee editor, each task costs whatever tokens it consumes, and the whole conversation history is re-sent on every request. Output tokens run about five times the price of input, while cached reads cost roughly a tenth of the normal input price, so the shape of a session matters as much as the work itself. A single one-file fix might take five requests, each pushing the entire history back through the model.

The advice is concrete. Run /clear between unrelated tasks so old context stops riding along. Set /model and /effort at the start, because switching mid-conversation busts the prompt cache and forces a full re-send. Reference files with @-mentions instead of typing paths, which avoids a redundant read. Silence noisy commands with quiet flags, since a wall of test output stays in context for the rest of the session. Use /context to see what is loaded and /mcp to turn off servers you are not using, then run /compact before stepping away, because the prompt cache expires after an hour. The post reads less like marketing and more like an internal cheat sheet.

Why it matters

If you pay for Claude Code by the token, these habits cut cost without changing what you build, and clearing context or setting effort up front can meaningfully lower the tokens a session burns. Worth adopting before your next large task, not after the invoice arrives.

AnthropicClaude CodeEngineering