Why Claude Code Burns So Many Tokens, and How to Cut the Cost¶
The common advice, when Claude Code runs up a bill, is to clear context, narrow the task, and switch to a cheaper model. That advice is not wrong, but it treats every case the same and leads with the smallest lever. Cost on an agent is roughly context size multiplied by the number of turns. The per-token price is a constant you mostly cannot change; the two terms you can change are how much the agent re-reads each turn and how many turns it takes to converge. The sections below identify which term is driving your bill and what to change for each.
Why is it using so many tokens in the first place¶
An agent does not pay per question. It pays per turn, and every turn re-sends the resident context — the
system prompt, the CLAUDE.md, every file it has opened, and the full back-and-forth so far. A session that
has read three large files and gone twenty turns deep is re-billing all of that on turn twenty-one. This is
why a long, wandering session costs far more than its result suggests, and why the same task can vary by up to
30x in token consumption
depending on how it was run. The price did not change. The context and the turn count did.
A large resident context also degrades the work, which feeds back into more turns. As the window fills, the model attends less reliably to any single part of it — the effect Chroma named context rot and Anthropic has since adopted. A bloated context costs more per turn and makes each turn less likely to converge.
How do I tell which cause is mine¶
Three terms drive the bill, and the fix differs for each. Read the session before you change anything.
- Context size. Open the context indicator. If the window is most of the way full early in the session — a few
large files read, long command output pasted in — the resident context is the driver. The fix is to read
less and reset more: open
app/triage/classify.pydirectly rather than letting the agent scan the tree, and start a fresh session once a sub-task is done rather than carrying the history forward. - Iteration count. Watch whether turns are converging. An agent that edits, runs, fails, and edits again toward green is spending well. An agent re-reading the same files, trying variations of the same fix, or re-explaining its plan is looping without converging, and every loop re-bills the whole context. The fix is a tighter spec and a verification command it can run itself, so it knows when it is done instead of guessing.
- Model choice. This is the smallest lever, and the one the generic answer reaches for first. A cheaper model helps on mechanical, well-specified work; on an underspecified task it takes more turns to converge, and more turns on a cheaper model can cost more than fewer turns on a capable one. Match the model to the task, but fix context and iterations first.
Reading the session points to one of the three terms, and each has its own fix — in the order worth pulling them:
flowchart TB
Q{"Bill higher than the<br/>result suggests — read the session"}
Q -->|"window most-full early<br/>(big files, pasted output)"| CS["Context size<br/>the resident context is the driver"]
Q -->|"turns not converging<br/>(re-reading, re-trying, re-planning)"| IT["Iteration count<br/>every loop re-bills the whole context"]
Q -->|"context tight, turns converge,<br/>still expensive"| MC["Model choice<br/>the smallest lever"]
CS --> FCS["Read less, reset more —<br/>open the right file, start fresh between sub-tasks"]
IT --> FIT["Tighter spec + a verification command<br/>it runs itself, so it knows when it's done"]
MC --> FMC["Match model to task —<br/>but fix context and iterations first"]
See it on a real repository¶
The effect is reproducible, and the numbers are more convincing than the advice. The Practice Repo for this course, Triage, gives you a fixed task to run two ways and compare.
Run "add a confidence score to the classification output" twice. First, cold: no CLAUDE.md, and let the
agent find its way. It scans the tree, opens files it does not need, and the resident context climbs before it
makes a single edit. Second, primed: a short CLAUDE.md that names where app/triage/classify.py and
app/models.py live, plus the test command from tests/. The agent opens the right file directly and runs
the tests to check itself. The second run reaches the same result in fewer turns with a smaller context — the
same two levers, moving together. The full walkthrough, with the token figures at each step, is the lab in
Module 7.
Is my usage normal, and which lever to pull¶
Treat the per-token price as fixed and spend your attention on the two terms you control. The real lever is fewer iterations and a tighter context, rather than a cheaper model — switching models trims a constant while leaving the multiplier untouched. The order is: reset long sessions and keep the resident context small; give the agent a spec and a verification command so it converges in fewer turns; only then choose the model.
High cost is not in itself a sign something is wrong — a hard task that converges in many turns is money well spent. The warning sign is turns that do not converge: re-reading, re-trying, re-planning. That is also where human time disappears, which is the cost the bill does not show — METR found experienced developers were about 19% slower with AI tools while believing they were faster. Deciding when the agent is worth running, and reading the bill as a signal rather than a surprise, is the subject of Module 7. The next step is to open your context indicator mid-session and notice how full it already is.