erabot.ai
ProductPricingCase studiesEvalBlogDocs
Book a demo

How to reduce Claude Code token usage — and the bill it doesn't fix

TL;DR: You can reduce Claude Code token usage a lot with a handful of habits, because most of the spend is invisible overhead rather than your actual prompts. But those habits only shrink your assistant's bill. The LLM calls inside the product you ship run on every user request, forever, and no amount of session hygiene touches them.

Why your usage disappears so fast

The thing that makes Claude Code token usage feel unpredictable is that every message re-reads the whole conversation. Your cost compounds rather than adds: an early message might cost a few hundred tokens, and the thirtieth costs many thousands, because the prior turns are re-sent each time. One developer who instrumented a long session reported that around 98% of the tokens were spent re-reading history rather than processing anything new.

On top of the transcript, each turn silently reloads your system context, your project instructions, your skills, and — the big one — every connected tool's full definition.

That last item is worth a number. An engineer put an observability proxy between Claude Code and the API to see exactly what was being sent, then typed a single word: "hi." The request carried 121 tool definitions and roughly 108,000 tokens. After disconnecting unused MCP servers and turning off tools that workflow never called, the same message carried 14 tools and about 8,000 tokens — an 87% reduction with the workflow intact.

The word "hi" was never the problem. Everything attached to it was.

The habits that actually move the number

In rough order of payoff:

  • Start fresh between unrelated tasks. Because cost compounds, the same question asked in a clean session is dramatically cheaper than at the end of a long one. This single habit does the most work.
  • Disconnect MCP servers you aren't using. Tool definitions are loaded whether or not the model calls them. A single server can add many thousands of tokens to every message. Where a CLI exists, prefer it over an MCP server.
  • Compact before you're forced to. Auto-compaction triggers late, by which point context quality has already degraded. Compacting earlier, with explicit instructions on what to preserve, keeps both cost and output quality better.
  • Plan before executing. The largest single waste is an agent confidently going down the wrong path and producing work you discard. Tokens spent agreeing on an approach are cheaper than tokens spent undoing one.
  • Right-size the model per task. Use the mid-tier model as the default, the small model for formatting, summarising and sub-agent work, and the largest only where it genuinely earns its price. Sub-agent workflows in particular can use several times the tokens of a single session, because each sub-agent reloads its own full context — so delegate to them deliberately, and prefer a cheap model when you do.
  • Mind the cache window. Prompt caching is what makes a stable prefix cheap, but caches expire. Stepping away and coming back can mean your next message reprocesses everything at full price. Worth knowing before you conclude your usage "randomly spiked."
  • Be deliberate about what commands can run. When an agent runs a shell command, the entire output lands in context. A command that returns hundreds of lines is hundreds of lines you pay for.

Two framing notes. First, input dominates. A team presenting at an AI engineering conference measured a typical query on their project sending about 45,000 tokens of context when roughly 5,000 actually mattered, and found roughly 90% of their spend was input rather than output. Cutting output by three quarters saved them single-digit percentages; cutting input is where the money was. Second, hitting your limit is not automatically failure — if you are getting real work done, it means you are using the tool hard. The goal is removing waste, not rationing yourself.

The bill none of this fixes

Here is the part that gets skipped in every guide on how to reduce Claude Code token usage, including the good ones.

Everything above is about you, coding. That spend is capped, it is per-session, and the worst case is that you wait. The spend that compounds without bound is the LLM calls inside the application you ship — the ones running on every user request, every day, with no session to clear.

There is no /compact for production. If your code re-sends a large system prompt uncached on every request, you cannot clear the context — you have to change the call site. And the same four patterns that inflate an agent session show up in shipped code:

  1. A frontier model doing a trivial job. A classifier, an extractor, a short label running on a model that costs 20–60× more than one that handles it fine. The model string gets written once and never revisited; models get cheaper and better every few months, and the code does not update itself. We found exactly this in OpenAI's own Swarm framework — a name extractor on a model roughly 65× pricier than it needed. The full teardown is here.
  2. The same context re-sent uncached in a loop — the production version of the 98% re-read problem.
  3. Oversized context — the 45,000-when-5,000-mattered pattern, running on every request instead of every session.
  4. No caps. A loop with no maximum turns, or calls with no token limit, is an open tap waiting for one malformed input.

The honest part

If you go looking for how much this saves, you will find a lot of 90% claims. Most of them are measured on logs, JSON, command output or tool schemas rather than source code. For real code, the credible published figures land nearer 20–55% — we went through the receipts in LLM token compression.

And the reason most teams have not already moved their trivial tasks to a cheaper model is not that they cannot find them. It is that a model which is 90% as good is a bargain on one task and a quiet disaster on another, and you will not learn which from eyeballing a few outputs — you will learn it from a customer. That is a verification problem, and it is settleable: here is how to prove a model swap holds quality before you ship it.

Want to know which of these are in your codebase? Run a free scan — it finds the call sites, resolves the model even when it's set in a config file or behind an SDK wrapper, and gives you a dollar estimate per site with every assumption labelled.

EB
erabot.ai

Scan any codebase. See exactly what you spend on AI. Get one-click fixes.

No spam. Only launch updates and cost optimization tips.

Product

  • Product
  • CLI
  • Pricing
  • Changelog
  • Docs

Resources

  • Example audit
  • Blog
  • Case studies
  • Eval

Company

  • Security
  • Privacy
  • Terms
  • Support

© 2026 erabot.ai. All rights reserved.