Key Takeaway
Claude Code bills by tokens, so your cost tracks how much context flows through the model, not how many messages you send. The largest savings come from keeping the context window lean with regular resets, matching the model to each task, and delegating bulky reads to subagents. A handful of habits cuts spend without hurting output.
Claude Code is priced by tokens, and tokens behave differently from the request-based billing many developers expect. Every file the agent reads, every command output it sees, and every earlier turn of the conversation is re-sent to the model on the next turn. Cost, then, is mostly a function of how much context you keep in play, not how many prompts you type.
This explainer walks through where the spend concentrates and the handful of levers that move it. None of them require a different plan or a weaker model; they are habits and settings you already control inside a normal session.
Where the money actually goes
A single turn costs the input tokens the model reads plus the output tokens it writes. In agentic coding the input side dominates, because the entire conversation so far, including every file and tool result, is replayed on each new turn. A long session is expensive less because of its final answer and more because of everything it is still carrying.
In practice, three drivers explain most of any bill:
- Conversation length, since a session that has run for an hour resends a large history on every message.
- Large file reads and verbose command output, which land in context and stay there until you clear them.
- Model choice, because the strongest model costs several times more per token than a smaller one.
Keep the context window lean
The cheapest token is the one you never send. Because history is replayed each turn, the highest-leverage habit is simply resetting context when you move on. The /clear command wipes the conversation between unrelated tasks, and /compact summarizes a long thread into a shorter form when you want to keep the gist but drop the bulk.
Claude Code also applies prompt caching automatically, so the stable front of your context, such as system instructions and files that have not changed, is billed at a reduced rate on repeat turns. You benefit from it for free, but only if you avoid needlessly reshuffling early context, which invalidates the cache.
Running /clear between tasks is essentially free and is the single highest-return habit for controlling spend. Start each new task from a clean window instead of dragging an hour of unrelated history behind you.
Match the model to the task
Not every task deserves your most capable model. Routing routine work to a smaller, cheaper model and reserving the strongest one for genuinely hard reasoning can cut spend sharply with little quality loss.
- Use a small, fast model like Haiku for mechanical, well-scoped work such as renames, boilerplate, and simple lookups.
- Use a mid-tier model like Sonnet as your everyday default for most feature work and debugging.
- Reserve the strongest model for architecture, tricky bugs, and tasks where a wrong answer is costly.
- Route high-volume subagents to a cheaper model while the orchestrating session stays on a stronger one.
Delegate bulky work to subagents
Subagents run in their own context window and return only a summary, which keeps large file reads and tool output out of your main session. For breadth-first work like exploring a codebase, that isolation both protects the main window and stops it drifting as it fills.
The catch is that delegation is not automatically cheaper. Each subagent re-reads the context it needs, so a run that fans out across several agents can use far more tokens overall. Anthropic has reported that multi-agent systems can consume on the order of fifteen times the tokens of a single chat, so reserve them for work that genuinely benefits from parallel breadth.
Do not assume more agents means lower cost. A multi-agent run trades main-window context for total token volume, and used carelessly it produces a larger bill, not a smaller one. Delegate for isolation and breadth, not as a reflex.
Track and cap what you spend
You cannot optimize what you do not measure. Before tuning anything, get visibility into where tokens go, then set guardrails so a runaway session cannot surprise you.
- Use the /cost command in a session to see token usage and spend so far for that conversation.
- Prefer a flat subscription plan over metered API billing if your usage is heavy and steady, since predictable pricing removes the per-token anxiety.
- For teams, export usage telemetry and set budget alerts so spend is visible per developer rather than discovered at month end.
Cost control in Claude Code is not about using it less; it is about carrying less. Reset context between tasks, match the model to the difficulty of the work, delegate bulky reads deliberately, and watch the numbers with /cost. Those four habits keep spend proportional to the value you are getting out.

