Claude Code Cost: Real Pricing Data From 100M Tokens
How much does Claude Code cost?
I tracked 100.9M tokens across 1,289 coding sessions to find out. The real answer depends heavily on one feature: prompt caching.
Without caching: ~$310 for 100M tokens. With 84% cache hit rate: ~$82 for 100M tokens.
That’s a 74% cost reduction.
The Pricing Model
Claude Code uses Anthropic’s API pricing, which charges separately for input and output tokens at different rates.
+-------------------+------------+-------------+| Token Type | Uncached | Cached |+-------------------+------------+-------------+| Input | $3.00 | $0.30 || Output | $15.00 | $15.00 |+-------------------+------------+-------------+Prompt caching reduces input token costs by 90% (from $3.00 to $0.30 per million tokens). Output tokens remain at full price.
Real-World Costs: With vs Without Caching
From my tracking data of 100.9M tokens:
WITHOUT PROMPT CACHING:+-------------------+------------+----------+--------+| Type | Tokens | Rate | Cost |+-------------------+------------+----------+--------+| Input | 100.3M | $3/M | $301 || Output | 616K | $15/M | $9 |+-------------------+------------+----------+--------+| TOTAL | ~$310 |+-------------------+------------+----------+--------+
WITH PROMPT CACHING (84% cache hit rate):+-------------------+------------+----------+--------+| Type | Tokens | Rate | Cost |+-------------------+------------+----------+--------+| Cached Input | 84.2M | $0.30/M | $25 || Uncached Input | 16.1M | $3/M | $48 || Output | 616K | $15/M | $9 |+-------------------+------------+----------+--------+| TOTAL | ~$82 |+-------------------+------------+----------+--------+The difference: $228 saved through prompt caching.
Per-Request Costs
Breaking it down to individual requests:
+-------------------+------------------+------------------+| Metric | Without Caching | With Caching |+-------------------+------------------+------------------+| Tokens/Request | ~78,277 | ~78,277 || Cost/Request | ~$0.24 | ~$0.06 || Savings/Request | - | ~$0.18 |+-------------------+------------------+------------------+With caching, each request costs about $0.06. Without it, $0.24.
That 4x difference compounds quickly over hundreds of requests.
Why Prompt Caching Works So Well
Claude Code is a read-heavy system. Of the 100.9M tokens I tracked:
- 99.4% were input (context reading)
- 0.6% were output (code generation)
+-------------------+------------+------------+| Type | Tokens | Percentage |+-------------------+------------+------------+| Input | 100.3M | 99.4% || Output | 616K | 0.6% |+-------------------+------------+------------+This distribution makes caching extremely effective. Claude Code re-reads the same context repeatedly:
- Files - Your codebase doesn’t change between most requests
- System prompts - Static instructions loaded every session
- Tool definitions - The same schemas reused across requests
- Conversation history - Grows incrementally, with earlier parts unchanged
The 84% cache hit rate in my data shows that most context is reused.
Factors That Affect Your Costs
1. Cache Hit Rate
The biggest factor. My 84% hit rate isn’t guaranteed.
+-------------------+------------+------------+| Cache Hit Rate | Input Cost | Total Cost |+-------------------+------------+------------+| 0% (no cache) | $301 | ~$310 || 50% | $163 | ~$172 || 84% (my data) | $73 | ~$82 || 90% | $58 | ~$67 |+-------------------+------------+------------+Higher cache rates = lower costs.
What increases cache hits:
- Longer sessions (more context reuse)
- Consistent file references
- Similar tasks within a session
What decreases cache hits:
- Many short sessions
- Switching between unrelated projects
- Frequently changing context
2. Model Selection
Claude Code supports multiple models with different pricing:
+-------------------+------------------+------------------+| Model | Input (Uncached) | Output |+-------------------+------------------+------------------+| Claude 3.5 Sonnet | $3.00 | $15.00 || Claude 3.5 Haiku | $0.80 | $4.00 |+-------------------+------------------+------------------+Haiku is 73% cheaper for input and 73% cheaper for output.
When to use Haiku:
- Simple refactoring
- Documentation updates
- Code explanation
- Routine tasks
When to use Sonnet:
- Complex architectural decisions
- Debugging intricate issues
- Feature implementation
- Multi-file refactoring
3. Project Size and Complexity
Larger codebases mean more context per request.
+-------------------+------------------+------------------+| Project Type | Tokens/Request | Cost/Request* |+-------------------+------------------+------------------+| Small (<100 files)| ~50K | ~$0.04 || Medium (100-500) | ~80K | ~$0.06 || Large (500-2000) | ~120K | ~$0.09 || Enterprise (2000+) | ~180K+ | ~$0.14+ |+-------------------+------------------+------------------+
* With 84% cache hit rateMore files = more context to read = higher costs.
4. Session Length
Each new session has fixed overhead: system instructions, tool definitions, initial context loading.
+-------------------+------------------+------------------+| Session Requests | Overhead/Request | Efficiency |+-------------------+------------------+------------------+| 5 requests | High | Poor || 20 requests | Medium | Moderate || 50+ requests | Low | Good |+-------------------+------------------+------------------+Longer sessions amortize the overhead across more requests.
Budget Expectations
Based on my data, here’s what to expect:
For Individual Developers
+-------------------+------------------+------------------+| Usage Level | Requests/Month | Cost/Month |+-------------------+------------------+------------------+| Light | 50-100 | $3-6 || Moderate | 200-400 | $12-24 || Heavy | 500-1000 | $30-60 || Intensive | 1000+ | $60+ |+-------------------+------------------+------------------+
Assumes 84% cache hit rate, ~$0.06/request averageFor Teams
+-------------------+------------------+------------------+| Team Size | Requests/Month | Cost/Month |+-------------------+------------------+------------------+| 2-3 developers | 500-1500 | $30-90 || 5-10 developers | 2000-5000 | $120-300 || 10+ developers | 5000+ | $300+ |+-------------------+------------------+------------------+
Assumes 84% cache hit rate, ~$0.06/request averageComparison with Alternatives
How does Claude Code’s pricing compare?
+---------------------------+------------------+| Solution | Cost/Month |+---------------------------+------------------+| Claude Code (light use) | $3-6 || Claude Code (moderate) | $12-24 || Claude Code (heavy) | $30-60 || GitHub Copilot | $10 || Cursor Pro | $20 || Claude Pro subscription | $20 |+---------------------------+------------------+Key insight: With prompt caching, Claude Code becomes cost-competitive with subscription alternatives while offering superior code quality.
For light to moderate users, Claude Code can actually be cheaper than fixed-price subscriptions.
Strategies to Reduce Costs
1. Maximize Cache Hits
- Keep sessions long rather than starting fresh
- Work on related tasks in sequence
- Avoid jumping between unrelated projects mid-session
2. Use the Right Model
- Default to Haiku for routine tasks
- Switch to Sonnet only when needed
- Let Claude Code auto-select when appropriate
3. Manage Context Explicitly
- Remove irrelevant files from context
- End sessions when switching projects
- Use
.claudeignoreto exclude unnecessary files
4. Batch Similar Operations
Instead of:
Request 1: "Fix this bug in auth.ts"Request 2: "Fix this bug in user.ts"Request 3: "Fix this bug in api.ts"Try:
Request: "Fix these bugs in auth.ts, user.ts, and api.ts"One larger request often costs less than multiple small ones.
Summary
Based on tracking 100M tokens across 1,289 coding sessions:
+-------------------------------+------------------------------------------+| Metric | Value |+-------------------------------+------------------------------------------+| Cost without caching | ~$310 for 100M tokens || Cost with 84% cache hit | ~$82 for 100M tokens || Cost reduction | 74% || Per-request cost (cached) | ~$0.06 || Per-request cost (uncached) | ~$0.24 || Typical individual monthly | $12-24 (moderate use) || Typical team monthly | $120-300 (5-10 developers) |+-------------------------------+------------------------------------------+The real answer to “how much does Claude Code cost” is: it depends on your cache hit rate.
With effective prompt caching (which happens automatically), Claude Code becomes surprisingly affordable. My data shows 84% of input tokens were cached, resulting in costs that compete with flat-rate subscription services.
For individual developers doing moderate coding work, expect $12-24/month. For teams, budget based on $0.06 per request as a baseline, adjusting for your specific cache hit rate and model selection.
The 74% savings from prompt caching isn’t just a feature. It’s what makes Claude Code economically viable for serious development work.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments