The two changes that matter most are routing routine work to a cheaper model and naming the files in your prompt; together they routinely halve spend. After that, in order: clearing context between tasks, delegating verbose reads to subagents, lowering effort on routine turns, keeping CLAUDE.md under 200 lines, avoiding cache misses, scoping what commands print, and trimming MCP overhead. Measure first, because agent spend is heavily skewed and untargeted trimming misses the sessions that cost real money.
- Model routing and prompt precision beat everything else combined.
- Every token the agent spends finding something is a token you did not need to buy.
/clearbetween unrelated tasks is the cheapest habit on this list. It costs nothing to run.- A cache miss reprocesses your whole context. Cache lifetime is one hour on a subscription and five minutes on usage credits or an API key.
- Thinking tokens bill as output. Lowering
/efforton routine turns is a real, underused lever. - Measure first. Untargeted savings trim the cheap sessions and miss the expensive ones.
Measure before you optimize
Agent spend is heavily skewed. In most months a handful of long exploratory sessions account for the majority of the total, so optimizing uniformly means spending effort on sessions that cost cents while ignoring the ones that cost dollars.
For scale, Anthropic reports Claude Code averaging about $13 per developer per active day and $150 to $250 per developer per month across enterprise deployments, staying under $30 per active day for 90 percent of users, as of August 2026. If you are far above that band, the cause is almost always one of three things: Opus left as the default, a session nobody ever cleared, or an unsupervised run that kept going.
Run /usage and press w
That switches the breakdown from the last 24 hours to the last 7 days. On a Pro, Max, Team, or Enterprise plan it also attributes recent usage to skills, subagents, plugins, and individual MCP servers, each as a percentage of the total.
Read the behavior flags
Claude Code flags any behavior accounting for 10 percent or more of recent usage, such as long context or cache misses. That flag is usually the whole diagnosis and it is free to look at.
Sort your sessions by cost, descending
The figures in /usage come from local session history on one machine, so they miss other devices and claude.ai. If you work across machines or accounts, aggregate the session files themselves.
The eleven changes, ranked
Ranked by typical saving on a real workload. Percentages are editorial estimates from ordinary agent use, not vendor figures.
| # | Change | Typical saving | Effort |
|---|---|---|---|
| 1 | Default to Sonnet, escalate to Opus deliberately | 40 to 70% | One setting |
| 2 | Name files and symbols in the prompt | 20 to 60% | A habit |
| 3 | /clear between unrelated tasks | 10 to 30% | A habit |
| 4 | Delegate verbose reads to subagents | 10 to 25% | One sentence |
| 5 | Lower /effort on routine turns | 5 to 25% | One command |
| 6 | Scope test and build commands, or filter them in a hook | 5 to 25% | One hook |
| 7 | Avoid cache misses on long-running sessions | 5 to 20% | A habit |
| 8 | Plan mode before large changes | 5 to 20% | Shift+Tab |
| 9 | Keep CLAUDE.md under 200 lines, move the rest to skills | 3 to 10% | One edit |
| 10 | Disable unused MCP servers | 2 to 10% | /mcp |
| 11 | Stop autonomous runs and agent teammates that have gone quiet | Variable, sometimes large | Attention |
The two that matter most
1. Model routing
Opus 5 costs $5 in and $25 out per million tokens. Sonnet 5 is $3 and $15 from 1 September 2026, and is running at introductory pricing of $2 and $10 through 31 August 2026. Haiku 4.5 is $1 and $5. For a large fraction of real work, the cheaper model produces the same diff.
The useful framing is not "which model is best" but "which model is sufficient for this task". Renaming a symbol across twenty files, writing tests to a stated spec, applying a described refactor: Sonnet and often Haiku do these correctly. Reserve Opus for genuine reasoning, unfamiliar architecture, and bugs that have already defeated one attempt.
# Switch the current session
/model sonnet
# Opus while planning, Sonnet while executing
/model opusplan
# In a subagent definition, front matter:
# model: haiku
2. Prompt precision
The single most expensive phase of any agent task is orientation: finding the relevant code. It burns turns, and every turn re-sends everything accumulated so far.
The same task, two prompts. Illustrative token counts from ordinary sessions.
| Prompt | Turns | Input tokens | Cost at Sonnet 5 |
|---|---|---|---|
| "Fix the retry bug" | 14 | 400k | $1.20 |
"Fix the exponential backoff in client/http.ts:retry, it is not capping at 30s" | 5 | 120k | $0.36 |
Nothing else on this page has that leverage, and it costs you ten seconds of thought. Vague requests like "improve this codebase" trigger broad scanning; specific ones let Claude work with minimal file reads.
Context hygiene
Claude Code sends your full conversation with every request, and each tool call sends another request carrying that batch of results. A one-line question in a session that has been open all day still draws usage for the whole conversation.
- Clear between tasks.
/clearcosts nothing and starts a new context. Use/renamefirst so you can/resumethe old one later. - Compact with a focus.
/compact Focus on the auth bug fixkeeps what you choose instead of what the automatic pass guesses. You can also put standing compaction instructions inCLAUDE.md. - Delegate the verbose reads. Send test runs, log processing, and documentation fetches to a subagent. The output stays in the subagent context window and only the summary comes back to yours.
- Keep project memory small.
CLAUDE.mdloads at session start and is present even when you are doing unrelated work. Anthropic suggests keeping it under 200 lines and moving workflow-specific instructions into skills, which load on demand. - Prefer CLI tools to MCP servers where one exists.
gh,aws, andgcloudadd no per-tool listing at all. Run/contextto see what is consuming space and/mcpto disable servers you are not using.
The cache lever nobody uses
Prompt caching is what makes agent sessions affordable: a cache read costs 10 percent of the base input rate, so the repeated prefix on turn thirty is billed at a tenth of what turn one paid for it. Claude Code applies it automatically. The failure mode is the gap.
Prompt cache lifetime by billing rail, August 2026. After this long without a request, the next message reprocesses your full context at full input price.
| How you are billed | Cache lifetime |
|---|---|
| A Pro, Max, Team, or Enterprise subscription | One hour |
| Subscription, while drawing on usage credits | Five minutes |
| An API key or a cloud provider | Five minutes by default |
The practical rule: a session you leave open over lunch and return to is a full context reprocess on the first message back. On a 400K-token context at Sonnet 5 that is roughly a dollar to say "carry on". Two habits fix it.
- Finish or clear before a long break. If the task is done,
/clear. If it is not, at least know the first message back is expensive and make it a substantial one. - Resume from a summary. On Pro and Max, Claude Code offers this when you resume a large session after a long break, so later requests do not carry the full history.
Effort, hooks, and the things that are actually configurable
Turn the reasoning down for routine work
Extended thinking is on by default because it materially improves hard tasks. Thinking tokens bill as output tokens, which are the most expensive category, and the default budget can run to tens of thousands of tokens per request.
# For this session
/effort low
# For one launch
claude --effort medium
# For scripts, overrides everything else
export CLAUDE_CODE_EFFORT_LEVEL=low
# Fixed-budget models only: cap the thinking budget
export MAX_THINKING_TOKENS=8000
Low effort on mechanical work is one of the least painful savings available. Escalate with the ultrathink keyword in a single prompt when one turn genuinely needs it, rather than paying for depth on every turn.
Filter tool output before Claude sees it
Every command the agent runs returns output that becomes input tokens on the next turn. A test suite printing 5,000 lines is a purchase. A PreToolUse hook can preprocess it down to the part that matters.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/filter-test-output.sh" }
]
}
]
}
}
Anthropic gives the worked example: the script rewrites npm test, pytest, or go test into the same command piped through a grep for failures, turning tens of thousands of tokens into hundreds. Verify it with /hooks, or run claude --debug and look for modified tool input keys: [command].
Watch what parallelism costs
Agent teams spawn multiple Claude Code instances, each with its own context window. Anthropic puts them at roughly seven times the tokens of a standard session when teammates run in plan mode. Keep teams small, use Sonnet for teammates, keep spawn prompts focused, and shut teammates down when their work is finished, because each one keeps consuming until it exits.
What not to bother with
- Shortening your own prompts. Your words are a rounding error next to file contents and tool output. Be precise, not brief; they are different things.
- Disabling caching. Caching is what makes long sessions affordable. There is no version of this that saves money.
- Chasing background token use. Conversation summarization and status checks typically cost under $0.04 per session. Not where your money is.
- Avoiding the agent for real work. If a $2 session replaces an hour, it was the cheapest thing you did that day. Cost control means removing waste, not removing use.
Questions people ask
Switch the default model from Opus to Sonnet with /model sonnet, or use /model opusplan to plan on Opus and execute on Sonnet. On most workloads that alone removes 40 to 70 percent of token spend, and for the majority of tasks the output is indistinguishable.
Yes, meaningfully, and /clear itself costs nothing. Claude Code sends your full conversation with every request, so carrying an old task into a new one means paying for irrelevant history on every turn. Use /rename first if you may want to /resume it later.
Usually a cache miss. The prompt cache lasts one hour on a subscription and five minutes on usage credits or an API key, so the first message after a long break reprocesses your entire context at full input price. Scheduled tasks, running agent teammates, and a large context do the same.
They do not reduce the flat fee, but they reduce how fast you consume your allowance, which means fewer interruptions and possibly a cheaper tier. If you have usage credits enabled, they reduce real cash spend, because overflow is billed at standard API rates.
No. Your prompt is trivial next to file contents and command output. Precision saves money by reducing turns; brevity does not. Naming a file and a symbol is worth far more than deleting adjectives.
It can. Thinking tokens are billed as output tokens, the most expensive category, and the default effort is high. Running /effort low or medium on mechanical work is a direct saving, and you can escalate a single turn with the ultrathink keyword instead.
For mechanical, well-specified edits, often yes, at $1 in and $5 out per million tokens. For anything requiring judgement about unfamiliar code, no. A common pattern is Sonnet for the session and model: haiku in the front matter of narrow subagents.
Halving is a normal result from model routing and prompt precision alone, without doing less work. Adding context hygiene and subagent delegation can take a heavy workload down further. Beyond that the returns diminish quickly and you start trading time for tokens.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.