Claude Code has no separate subscription. You pay for tokens through the Anthropic API or through an Anthropic Max plan. Both routes have very different cost profiles, and most developers pick the wrong one for their usage pattern.
This guide breaks down what Claude Code actually costs per task, where hidden token drains come from, and 7 concrete ways to cut spending by 60%+ without degrading output quality.
Two Pricing Models
Claude Code runs on two billing models. The Anthropic API charges per token. The Max subscription charges a flat monthly fee with rate limits. Your usage volume determines which one costs less.
| API (Pay-per-token) | Max Plan | |
|---|---|---|
| Sonnet 4.6 | $3 / $15 per million tokens (input / output) | $100/month unlimited within rate limits |
| Opus 4.6 | $15 / $75 per million tokens (input / output) | $200/month unlimited within rate limits |
| Best for | < 10 tasks/day, occasional use | > 10 tasks/day, daily use |
Token caching discount
When Claude re-reads files it has recently seen, cached tokens cost 10% of normal input pricing. The cache has a 5-minute TTL but resets on every read. Active sessions where you work on the same files benefit heavily from this. On API pricing, caching can reduce input costs by 40-60% in practice.
Real Per-Task Costs
A typical coding task involves Claude reading files, thinking about the problem, making edits, and running tests. Here is what that actually costs in tokens and dollars.
| Task Type | Input Tokens | Output Tokens | Sonnet Cost | Opus Cost |
|---|---|---|---|---|
| Simple edit | 30K-50K | 2K-5K | $0.12-$0.22 | $0.60-$1.12 |
| Bug fix w/ tests | 80K-150K | 8K-15K | $0.36-$0.67 | $1.80-$3.37 |
| New feature | 150K-300K | 15K-30K | $0.67-$1.35 | $3.37-$6.75 |
| Cross-file refactor | 300K-500K | 20K-40K | $1.20-$2.10 | $6.00-$10.50 |
| Complex debug session | 500K-1M | 30K-80K | $1.95-$4.20 | $9.75-$21.00 |
These numbers assume a single conversation. Multi-turn sessions accumulate context, pushing costs toward the high end. Starting a fresh session for each task keeps costs at the low end.
The Hidden Cost Driver: Context Growth
Claude Code re-reads your entire conversation history on every turn. This is the single biggest source of unexpected costs. A 10-turn conversation where turn 1 reads 5K tokens means turn 10 processes 50K+ tokens of accumulated context, even if you are asking a simple question.
How context costs compound
Turn 1: 5K input tokens → $0.075 (Opus)
Turn 2: 12K input tokens → $0.18
Turn 3: 22K input tokens → $0.33
Turn 5: 48K input tokens → $0.72
Turn 10: 95K input tokens → $1.42
Turn 20: 180K+ tokens → $2.70
Total for 20 turns: ~$15 in input tokens alone
Starting fresh every 5 turns: ~$4 totalCompaction is Claude Code's built-in mitigation. When context exceeds the window, Claude compresses the conversation into a summary. You can trigger this manually with /compact to reset costs mid-session without losing critical context.
Short sessions save money
Five sessions of 4 turns each cost significantly less than one session of 20 turns. The context accumulation in a long session means later turns are 5-10x more expensive than early turns. When you finish a discrete task, start a new session.
Extended Thinking Costs
When Claude "thinks" before responding, those thinking tokens are billed at output rates. On Opus 4.6, that is $75 per million tokens. A complex debugging session with extended thinking can generate 50K-200K thinking tokens per turn.
Extended thinking produces better results for complex reasoning tasks, but the cost difference is substantial. For routine edits and simple tasks, thinking is unnecessary overhead. Use model selection to route simple tasks to Sonnet where thinking costs are 5x lower.
7 Ways to Cut Claude Code Costs
Write a Comprehensive CLAUDE.md
A well-structured CLAUDE.md tells Claude where to find things, which patterns to follow, and what not to touch. This reduces exploratory file reads by 40-60%. Every file Claude doesn't need to read is tokens you don't pay for.
Use Sonnet for Routine Tasks
Switch to Sonnet 4.6 for simple edits, test writing, and refactoring with /model. Save Opus for cross-file architectural changes and complex debugging. Sonnet costs 5x less per token.
Start Fresh Sessions
Five sessions of 4 turns each cost less than one 20-turn session. Context accumulation means later turns cost 5-10x more. Finish a task, start a new session.
Use /compact Mid-Session
Trigger manual compaction when context grows large. Claude compresses the conversation to a summary, resetting token costs while preserving important context.
Set API Spend Limits
The Anthropic Console lets you set daily and monthly caps. Start with $20/day and adjust based on actual usage. This prevents surprise bills from runaway sessions.
Use Fast Apply for Edits
Morph's fast apply model handles file edits at 10,500 tok/s instead of using the full Claude model for every character change. This cuts edit-related token usage by 70-80%.
Use Subagents for Parallel Work
Subagents start fresh with only the context they need, avoiding the context accumulation problem. Three subagents with 20K context each cost less than one session at 200K context.
API vs Max: Break-Even Math
The break-even calculation depends on your daily task volume and which model you use.
| Daily Tasks | API (Sonnet) | API (Opus) | Max (Sonnet) | Max (Opus) |
|---|---|---|---|---|
| 5 tasks/day | ~$150/mo | ~$600/mo | $100/mo | $200/mo |
| 10 tasks/day | ~$300/mo | ~$1,200/mo | $100/mo | $200/mo |
| 20 tasks/day | ~$600/mo | ~$2,400/mo | $100/mo | $200/mo |
| 30+ tasks/day | ~$900+/mo | ~$3,600+/mo | $100/mo | $200/mo |
Max plan rate limits
The Max plan is unlimited within rate limits, not truly unlimited. Heavy users may hit rate limits during peak hours. If you consistently hit limits, API pricing with higher rate limits may be worth the extra cost. Check Anthropic's current rate limit tiers before committing.
Team Cost Optimization
For teams, costs multiply but so do optimization opportunities. Five developers running Claude Code independently duplicate context reads across the same codebase. Three strategies to reduce team-level waste:
Shared CLAUDE.md
One comprehensive CLAUDE.md file in the project root means every team member's Claude starts with the same knowledge. No redundant exploration.
Shared MCP Servers
Team-level MCP servers for database access, deployment, and internal tools mean Claude doesn't need to rediscover infrastructure on every session.
Agent Teams
Claude Code's agent teams feature lets multiple subagents share context instead of each developer running separate sessions for related work.
For more on team workflows, see our guide to Claude Code Agent Teams.
FAQ
How much does Claude Code cost per month?
Most solo developers spend $600-$1,800/month on API pricing (15-20 tasks/day on Opus). The Max plan caps this at $200/month for Opus or $100/month for Sonnet, with rate limits. The right choice depends on your volume.
Is Claude Code worth the cost?
At 15-20 tasks per day, Claude Code replaces 4-6 hours of manual coding. At a developer salary of $150K-$250K/year, that is $300-$500/day in time value. Even at $60/day API costs, the ROI is 5-8x.
Can I use Claude Code for free?
No. Claude Code requires either an Anthropic API key or a Max subscription. New API accounts typically receive $5 in free credits. There is no permanent free tier.
How do I track my Claude Code spending?
Use /cost in any Claude Code session to see real-time session costs. The Anthropic Console dashboard shows daily and monthly API usage with spend alerts and hard caps.
Cut Claude Code costs with Morph Fast Apply
Morph's fast apply model handles file edits at 10,500 tok/s, cutting edit-related token usage by 70-80%. Same quality edits, fraction of the tokens.