TLDR; Claude Code token costs come mostly from context: the files Claude reads, the conversation history it carries and the instructions it reloads every session. Plans run $20 (Pro), $100 or $200 (Max) a month, and the API bills per token. Start on Pro with usage credits and let the overage bill tell you when to move up. Send each job to the cheapest model that can do it, clear the conversation between unrelated tasks and keep CLAUDE.md short.
When to manage Claude Code token costs
- Your API bill grows, or you regularly hit your plan’s usage limits.
- You hand work to sub-agents often: helper sessions Claude starts for one job. Each loads its own files and instructions and can inherit settings you never chose.
- A new model has landed and your agents still carry settings tuned for the last one.
- You are choosing a plan without knowing your real usage.
- Skip the cost work if you stay well inside the Pro plan’s cap; steps 5 to 7 still help quality.
How Claude Code pricing and token costs work
A token is the unit Claude bills by: a fragment of text, roughly half a word on current models. Most of what you pay for is context: everything in Claude’s context window, the text it can see at once. That covers the files it has read, the conversation so far and the instructions that load every session, such as CLAUDE.md (your project’s standing instructions).
In spring 2026 Morphllm cited a developer who counted tokens across 42 agent runs and found 70% were waste. It also cited an analysis that put 87% of tokens on finding code rather than writing it.
The API, Anthropic’s pay-as-you-go access, bills per token. October 2026 rates in US dollars per million tokens (MTok); check Anthropic’s pricing page for today’s:
| Model | Input (per MTok) | Output (per MTok) | Cache read (per MTok) |
|---|---|---|---|
| Fable 5.1 | $10.00 | $50.00 | $0.25 |
| Opus 5.5 | $4.00 | $20.00 | $0.20 |
| Opus 5 | $5.00 | $25.00 | $0.50 |
| Sonnet 5.5 | $2.00 | $10.00 | $0.10 |
| Haiku 5.5 (prompts up to 100K tokens) | $0.10 | $0.50 | $0.01 |
| Haiku 5.5 (prompts over 100K tokens) | $0.50 | $2.50 | $0.05 |
Output costs 5x input on every model, and includes Claude’s thinking as well as the code it writes.
The cache is a stored copy of the start of a request Claude recently processed. When the next request starts the same way, as it does turn after turn in one session, those tokens are read from the cache at 90% off the input price (95% off on Opus 5.5 and Sonnet 5.5, 97.5% off on Fable 5.1). Creating the cache costs extra. In my heavy sessions, cache reads are the bulk of the input cost.
A subscription replaces line items with an allowance. Heavier models, large contexts and parallel sub-agents spend it faster.
How to cut Claude Code costs
1. Measure your usage, then choose a Claude Code plan
ccusage reads Claude Code’s local session files and reports usage on any plan, so you don’t need API billing to see where tokens go:
ccusage claude daily --breakdown
Anthropic reports an average of $13 per developer per active day across enterprise deployments, with $150–250 per developer per month typical and 90% of users under $30 a day.
Claude Code plan prices in US dollars, at October 2026 rates:
| Plan | Cost | Best for |
|---|---|---|
| Pro | $20/mo | Light use, a few sessions daily |
| Max 5x | $100/mo | Daily heavy use, 5x Pro limits |
| Max 20x | $200/mo | Full-time work with agents, 20x Pro |
API pay-as-you-go has no plan allowance, and for heavy use it can cost far more than a subscription. By Verdent’s own figures, one developer tracked 10 billion tokens over eight months. The API equivalent exceeded $15,000; Max for the same period cost around $800, which Verdent calls a 93% saving.
Start on Pro at $20 a month, which includes Claude Code, and enable usage credits. Past the cap, they bill the extra at API rates instead of cutting you off mid-session. After a few weeks of tracking, move up a tier when the cap regularly interrupts your work, or when your monthly overage approaches the price gap to the next tier ($80 from Pro to Max 5x).
Hitting the cap often enough to interrupt work?
yes
Move up a tierThe cap is costing you work
Monthly overage approaching the price gap to the next tier?
yes
Move up a tierUsage credits bill at full API rates; compare your monthly overage with the price gap
Otherwise
Stay on ProKeep tracking real usage with ccusage
Check: ccusage claude daily --breakdown shows your daily tokens and their estimated API-rate cost, your account’s usage page shows your plan limits and any usage-credit spend, and you can say whether either trigger has fired.
2. Route each job to the cheapest model that can do it
For prompts up to 100,000 tokens, Haiku 5.5 costs a fortieth of Opus 5.5 on input and output, and Sonnet 5.5 costs half (October 2026 rates). Haiku 5.5 also hallucinates (makes things up) more than other recent Claude models, according to its system card, so keep judgement calls off it. Fable 5.1 costs 2.5x Opus 5.5, and Opus 5.5 now beats it on Terminal-Bench 4.0, so save Fable for a problem Opus 5.5 can’t solve.
On API or Pro billing, default to Sonnet, with Opus for architecture and review and Haiku for searching code. On Max, a pricier model uses up your allowance faster, so still pick a model for each job you delegate. The model selection guide has the full table, with effort levels.
Keep one model in the main session, picked at the start. Each model has its own cache, so after a switch the next request reads the whole conversation again without the cache discount. Changing effort keeps the cache on the 5.5 models and Fable 5.1.
A typical sub-agent session on my Rails projects:
| Component | Tokens |
|---|---|
| System prompt + CLAUDE.md | ~3,000 |
| Codebase reads (5–15 files) | ~8,000–25,000 |
| Reasoning and generation | ~2,000–5,000 |
| Typical agent total | ~15,000–30,000 |
Five agents cost five of those. Give each the model its job needs:
- Explore (read-only search): Haiku. Built-in Explore uses the main conversation’s model unless you name one, so an Opus session makes every Explore run an Opus run.
- Plan (architecture) and review (catching bugs): Opus. Design decisions and subtle issues need the strongest reasoning.
- Implementation (routine code): Sonnet. Standard Rails models and tests don’t need Opus.
Check: every agent you delegate to often names its model in its definition file, and the main session still runs the model it started on.
3. Set effort per job, and pin it for sub-agents
Effort sets how many tokens Claude spends on a response, at one of five levels: low, medium, high, xhigh or max. It shapes thinking and tool calls (actions such as reading a file). At lower effort Claude makes fewer of them, batches operations and skips the preamble. Turn it down with /effort for simple tasks. Models with adaptive reasoning, which decide for themselves how long to think, ignore the older MAX_THINKING_TOKENS setting.
As of October 2026, Claude Code defaults to medium on Opus 5.5, Sonnet 5.5 and Haiku 5.5, high on most older models, and xhigh on Opus 4.7 (model configuration docs). A sub-agent without its own effort runs at the session’s level, so a file-finding agent started from a high session runs at high. In my tracking that is the commonest overspend, and no invoice line shows it. Pin effort in the settings block at the top of the agent’s definition file, for example .claude/agents/file-finder.md:
---
name: file-finder
description: Finds the files and code relevant to a task. Read-only.
model: haiku
effort: low
tools: Read, Grep, Glob
---
Or pass effort each time you start the agent (Claude Code v2.1.292 and later, per the subagents docs).
If output disappoints after you lower effort, restore the earlier level first. If you had not lowered it, try a stronger model before more effort. In Anthropic’s advisor pattern, a cheap model does the work and can ask a stronger one for advice. In its benchmarks, Haiku 4.5 with an Opus 4.6 advisor scored 41.2% on BrowseComp against 19.7% for Haiku alone. More effort on a model out of its depth mostly buys a longer wrong answer.
Anthropic’s cost and intelligence guide reports that on 198 GPQA Diamond questions, a graduate-level science benchmark, Haiku 5.5 and Sonnet 5.5 never called their Opus advisor when the prompt gave no instruction to consult. State in your prompt when to consult, and check whether the model does.
Check: every agent you delegate to often has an effort: line in its definition, or you pass one each time you spawn it.
4. Re-test effort when the model changes
For Opus 4.7 and 4.8, Anthropic advised starting at xhigh for coding and agentic work, with high the floor for anything intelligence-sensitive. For Opus 5, the same page says to start at high, the default. It says to use low and medium liberally as your primary cost control wherever your own quality tests show quality holds. Opus 5.5 moved the default down again, to medium, and the docs say to re-test any effort settings carried over from an earlier model.
When a new model lands, re-run your cheapest and most expensive delegated tasks at two or three effort levels before you update any agent. In my setup that takes twenty minutes. Skip it, and agents pinned for an old model overpay on mechanical work and under-think hard work, and the bill doesn’t say which.
Check: you have results for those tasks at two or three effort levels on the current model, and each agent’s effort matches them.
5. Clear stale context, and know what loads at startup
Run /context in a fresh session. In my sessions, a 200K window has roughly 145,000–167,000 tokens of working space left before I type. Four things take the rest: the system prompt, CLAUDE.md files, MCP tool names and the buffer Claude Code reserves for compaction (summarising a long conversation to free space). MCP servers are add-ons that give Claude extra tools; current versions load each tool’s full description only when needed.
Then the window fills: in my projects a typical file read costs 500–2,000 tokens, a test suite’s output 5,000+.
Every current model runs a 1M-token window by default in Claude Code (model configuration docs), at the same per-token rate across the whole window for Opus and Sonnet. A bigger window still bills every token you keep in it.
Quality also drops as the window fills: long-context research finds models neglect the middle of the context, which is where your earlier decisions end up. My own tracking on 200K windows shows three phases:
- Fresh0–40%Sharp, follows all instructions, remembers everything
- Working40–65%Still effective; start planning your next compact or clear
- Degrading65%+Missed instructions, repeated suggestions, reversed earlier decisions
/clear empties the conversation and costs zero tokens. Reloading CLAUDE.md and a few key files costs 3,000–5,000, small next to a degraded 150K-token session. If the next task doesn’t need this one’s context, clear. If you must compact mid-task, tell /compact what to keep, or it can drop an architecture decision from forty minutes ago. The session craft guide has the compaction prompt and the auto-compact setting.
Check: you know your startup load from /context, and the current session holds one task.
6. Trim CLAUDE.md to what every session needs
CLAUDE.md loads at the start of ordinary sessions and in custom sub-agents that inherit project instructions; the built-in Explore and Plan agents load less. Every line is paid for again each session, relevant or not. Measure it with /context, then sort every line. A prompt for the sort:
Read CLAUDE.md. Tag every line essential (needed in every session),
situational (needed only for some tasks) or discoverable (Claude could
find it by reading the code). List the situational lines as skill
candidates and the discoverable lines to delete.
Move situational lines to skills. A skill is a set of instructions whose full text loads only when a task calls for it; its short description still loads at startup. Deployment steps, for example, become a /deploy-checklist skill. Delete discoverable lines: you pay for each one to tell Claude what it could read for itself, such as the routes in config/routes.rb.
On one of my client projects, CLAUDE.md had grown to 280 lines and roughly 8,500 tokens, 4.3% of the 200K window. Across a day of 15 sessions that’s 127,500 input tokens before cache discounts: roughly $0.51 on Opus 5.5, or $0.26 at Sonnet’s standard $2/MTok rate (October 2026 rates). The audit cut it to 85 lines and roughly 2,400 tokens, with the same output quality on the same tasks, and slightly better on one.
- MeasureRun /context at the start of a fresh session
- CategoriseEvery line: essential, situational or discoverable
- Move to skillsSituational knowledge, such as a /deploy-checklist skill
- Delete discoverable linesClaude can read config/routes.rb when it needs it
- Fewer lines, fewer tokens280 lines to 85; 8,500 tokens to roughly 2,400
Anthropic’s memory documentation targets roughly 200 lines or fewer, essentials only. I’d push for under 100.
Check: CLAUDE.md is under 200 lines, and /context in a fresh session shows it taking less than before the audit.
7. Cut what Claude reads
- Write specific prompts. “Add input validation to the login function in
auth.ts” costs far less than “improve the auth module”, which sends Claude reading files to guess what you mean. - Plan larger work in Plan Mode (Shift+Tab), where Claude reads and plans but writes no code. A well-planned task often completes in one pass; each correction round fills the window further.
- Send code searches to a Haiku Explore agent. It reads twenty files in its own context and returns a 1,000-token summary.
- Filter data before Claude sees it. A 10,000-line log through
grep -E "(ERROR|WARN)"becomes a few hundred lines. A hook (a script Claude Code runs on an event) that strips passing tests can cut 5,000+ tokens of test output to a few hundred. The skills and hooks guide shows how. - Prefer a command-line tool (CLI) to an MCP server when one exists. Anthropic’s cost documentation notes that CLI tools like
ghandawsadd no tool definitions to every request.
Check: the last test run or log Claude read showed only the failures or errors.
Pitfalls
| Symptom | Cause | Fix |
|---|---|---|
| Explore runs cost Opus rates | Built-in Explore uses the main conversation’s model unless you name one | Name model: haiku for search agents |
| Delegated work overspends, and no invoice line shows why | A sub-agent without its own effort runs at the session’s level |
Pin effort in the agent definition, or pass it per spawn |
| One request costs far more than the rest | A model switch rereads the whole conversation without the cache discount | Pick the model at the start; change effort instead |
| Claude repeats suggestions or reverses decisions | The window is past about 65% (my threshold on 200K windows) and degrading | /clear between unrelated tasks; tell /compact what to keep |
In practice
In my first month running Claude Code across six client engagements at once, the API bill was over $900, for ordinary work: Rails features, debugging, code reviews, content generation. The second month was $340, with the same workload, clients and output quality.
In my tracking, three habits account for most of the savings: routing models deliberately, clearing between unrelated tasks and keeping CLAUDE.md lean. Making Sonnet the default on API billing cut my monthly spend by roughly 35%.
I paid API rates for a long time for the detailed tracking, then moved to Max 20x; I wouldn’t start someone on the API today. On Max I run Opus 5.5 at medium in the main session and route sub-agents by job. Routing still slips: in the month to 8 October, Claude Code’s cost report showed Explore sub-agents costing me $33.69 at list price, $31.88 of it on Opus, until a hook routed them to Haiku.
On projects where I’ve tested it, I set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=65 so automatic compaction starts at 65% instead of the default.
Small command-line tools replaced several of my MCP servers for Search Console, analytics and SEO data. In my measurements, their default filtering and compact output alone saved over 80% on data-heavy queries. A hook that rewrites routine dev commands into token-lean versions saves me 60–90% on everyday git and test operations.
In my experience, the bills above Anthropic’s averages come from multi-agent workflows run without model routing. I’ve run them myself. In the onboarding case study from the multi-agent guide, all six agents on Opus would have cost about 1.5x the mixed-model total at Opus 5.5 pricing. Running them in parallel turned about three hours of work done in sequence into 20 minutes.
My working break-even for parallel agents, from my own projects and billing, is a task over 45 minutes done in sequence, with at least three parts that can run separately. Below it, one well-managed session usually costs less.
Before an Applied AI build ships, I measure its cost as well as the time it saves and its quality.
Related reading
- How to write a CLAUDE.md file for Claude Code, what belongs in the file before you trim it
- Model selection, which Claude for which job, the model and effort for each kind of work, with the evidence behind each choice
- Session craft, when to start fresh, resume, or compact, the full session lifecycle model for context management
- Multi-agent orchestration, running parallel agents on real projects, parallel execution with cost data and model mixing
- Claude Code skills, hooks, subagents and commands: when to use each, moving knowledge from CLAUDE.md to on-demand skills
- 10 ways to reduce Claude Code token usage, the quick-reference version
- Stop letting your AI agent do a script’s job, moving deterministic steps out of the agent loop
Sources
- The Real Cost of AI Coding in 2026, Morphllm, archived May 2026. Cites a DEV Community developer’s 42 agent runs (70% of tokens wasted) and a separate analysis (87% of tokens spent finding code). The live page has since dropped both figures. Vendor analysis, secondary
- Anthropic API Pricing, Current per-token pricing for all Claude models. Includes the Haiku 5.5 price tier above 100,000 tokens and the cache-read multipliers. Documentation
- ccusage, Claude Code Usage Analysis, CLI tool that tracks Claude Code token use from local usage logs. Open-source tool
- Manage costs effectively, Claude Code Docs, Official Anthropic guidance on cost tracking, team limits, and reduction strategies. Documentation
- Claude Code Pricing 2026: Plans, Token Costs, and Real Usage Estimates, Plan comparison with the 10-billion-token case study. Guide
- Extra usage for paid Claude plans, Anthropic. Usage credits bill at standard API rates. Documentation
- Claude Haiku 5.5 system card, Hallucination results against other Claude models. System card
- Introducing Claude Opus 5.5, Anthropic, Terminal-Bench 4.0 against Fable 5.1. Product announcement
- Prompt caching, Claude Code Docs, Each model has its own cache; which settings keep it across an effort change. Documentation
- Create custom subagents, Claude Code Docs, Subagent model and effort settings, per-spawn effort, and the built-in Explore agent’s model. Documentation
- Effort, Anthropic, Per-model effort guidance, model support, and the effect on tool calls. Source for the shift in recommended starting effort between Opus 4.8 and Opus 5. Documentation
- Model configuration, Claude Code Docs, Claude Code effort defaults and the 1M-token default window. Documentation
- The advisor strategy, Anthropic, Haiku 4.5 with an Opus 4.6 advisor against Haiku alone on BrowseComp. Product announcement
- Optimizing for cost and intelligence, Anthropic, Advisor consult rates for the 5.5 models. Documentation
- Lost in the Middle: How Language Models Use Long Contexts, Liu et al., 2023. The research behind context window degradation patterns. Academic paper
- Use Claude Code with your Pro or Max plan, Anthropic. Confirms Claude Code access on Pro and the option to enable usage credits past the plan cap. Documentation
Common questions
How much does Claude Code cost?
Claude Code isn’t free. At October 2026 prices it comes with Claude Pro at $20 a month, or Max at $100 or $200 a month. The API charges per token, so heavy use costs far more there than on Max. Anthropic reports an average of $13 per developer per active day across enterprise deployments, and 90% of users stay under $30 a day.
Is the $20 Claude plan worth it?
For light use, yes: at October 2026 prices Pro costs $20 a month and suits a few sessions a day. Turn on usage credits, so going past the cap bills the extra at API rates instead of stopping you. If you hit the cap often, or the extra each month nears $80, the price gap between Pro and Max 5x, move to Max 5x at $100 a month. Verdent reports one developer whose eight months of use would have cost over $15,000 on the API, against $800 on Max 5x.
Why is Claude Code expensive?
Most of the cost is context: the files Claude reads, the conversation history it carries, and the instructions that reload every session. My first month’s API bill across client projects passed $900. The second, with the same workload, was $340. In my tracking, three habits did most of it: routing each job to the cheapest model that could do it, clearing between unrelated tasks and keeping CLAUDE.md lean.
Is it worth paying for Claude for coding?
Yes, for regular use. Anthropic reports typical enterprise spend of $150–250 per developer per month. I paid per token on the API for its detailed tracking, then moved to the $200 Max 20x plan, which has the highest usage limits.