Claude Code Pricing — Is It Free? Plans, Costs & Limits Explained
Claude Code is free to install — but it always uses API tokens, so there's a real cost to running it. Here's the honest breakdown: what you get free, what each plan costs, and how to estimate your monthly bill before you commit.
TL;DR: Claude Code Pricing at a Glance
| Plan | Monthly Cost | Best For | Rate Limits |
|---|---|---|---|
| API (pay-as-you-go) | $0 + usage | Occasional use, evaluation | Standard API limits |
| Claude Pro | $20/month | Individual developers | 5× higher than free |
| Claude Max | $100/month | Heavy daily use | 20× higher than Pro |
| Anthropic API (self-managed) | $0 base + token costs | Teams, automation, CI/CD | Configurable spend cap |
Is Claude Code Actually Free?
The CLI is free to install with npm install -g @anthropic-ai/claude-code. But every conversation you have with it consumes tokens from the Claude API — and those aren't free.
New Anthropic accounts get a small credit allocation for evaluation. After that, you need either:
- An Anthropic API key with a payment method on file (pay-per-token)
- A Claude Pro or Max subscription which includes a generous usage allocation
There is no unlimited-free tier. This is by design — Claude Code runs the full Claude Sonnet or Opus model behind the scenes, which has real compute costs.
API Billing: How Token Costs Work
When using an API key (not a Pro/Max subscription), you pay per token. As of mid-2026:
| Model | Input Tokens | Output Tokens | Context Window |
|---|---|---|---|
| Claude Sonnet 4 (default) | $3 / 1M tokens | $15 / 1M tokens | 200K tokens |
| Claude Opus 4 | $15 / 1M tokens | $75 / 1M tokens | 200K tokens |
| Claude Haiku 4 | $0.80 / 1M tokens | $4 / 1M tokens | 200K tokens |
A typical Claude Code session (asking it to refactor a module, write tests, fix a bug) uses roughly 50,000–200,000 tokens depending on file sizes. At Sonnet prices that's $0.15–$3.00 per session.
Claude Pro vs Max — Which Plan Makes Sense?
Claude Pro ($20/month)
The right choice for most individual developers. You get:
- 5× higher rate limits than the free tier
- Access to Claude Sonnet and Opus models
- Priority access during high-traffic periods
- Works across claude.ai, the mobile app, and Claude Code
If you're spending more than $20/month on raw API calls, switching to Pro often saves money.
Claude Max ($100/month)
For developers who use Claude Code as their primary development environment all day. You get:
- 20× higher rate limits than Pro
- Effectively unlimited use for most developers
- Best for large codebases with long context windows
- Best for CI/CD automation where Claude runs many parallel sessions
When to use pure API billing instead
API-only billing makes sense if you're:
- Building Claude Code into CI/CD pipelines or scripts
- Running it sporadically (a few sessions per week)
- Managing multiple team members who each need their own key
- Want granular cost control with per-project spend limits
How to Control Your Claude Code Spending
1. Set a monthly spend cap
In the Anthropic console at console.anthropic.com, set a hard monthly spending limit. Claude Code will return an error rather than exceed it.
2. Use Haiku for lightweight tasks
Force Claude Code to use the cheaper Haiku model for quick questions:
claude --model claude-haiku-4-5 "what does this function return?"
Use Sonnet or Opus only for complex refactors or architectural decisions.
3. Keep context windows tight
The biggest cost driver is large context windows — when Claude reads many files or has a long conversation history. Use /clear to reset context after completing a task, and use /compact to summarize long conversations before continuing.
4. Use CLAUDE.md to avoid repeated explanations
Instead of explaining your stack in every session, put it in CLAUDE.md. This is loaded once per session and doesn't count toward your conversation tokens.
5. Cache repeated prompts
If you're building on top of Claude Code or the API, use prompt caching to reduce costs on repeated prefixes by 90%.
Free Alternatives (and Their Limitations)
A few alternatives offer more free usage but with tradeoffs:
- GitHub Copilot Free: Free for up to 2,000 completions/month. Limited to completions/chat — no full agentic coding like Claude Code.
- Cursor Free: 50 fast requests/month, then paid. Good for IDE integration but no terminal/CLI workflow.
- Cody (Sourcegraph): Free tier available. Weaker on long-context reasoning.
If you need genuinely free AI coding help, compare Claude Code vs Cursor and Claude Code vs GitHub Copilot — the right choice depends on your workflow.
Frequently Asked Questions
Is there a free trial for Claude Code?
Yes — new Anthropic accounts receive free API credits that are sufficient to evaluate Claude Code for a few sessions. After the trial credits are used, you need to add payment or subscribe to Pro/Max.
Can I use Claude Code with a Claude.ai subscription?
Yes. Claude Pro and Max subscriptions include usage that counts toward Claude Code sessions. You authenticate via claude login and your subscription limits apply. This is often cheaper than pure API billing for active developers.
Does Claude Code charge per conversation or per token?
API billing is strictly per token — both input (what you send to Claude including file context) and output (what Claude writes back). Pro/Max subscriptions have usage limits measured in tokens but the billing is a flat monthly fee.
What happens if I hit my usage limit?
Claude Code displays a rate-limit error and pauses. On API billing with a spend cap, you get an "insufficient quota" error. On Pro/Max, you get a "usage limit reached" message and can continue after the limit resets (typically hourly or daily depending on the limit type).
Is Claude Code worth the cost vs free alternatives?
For developers doing complex, multi-file changes, agentic workflows, or custom automation: yes. Claude Code's context window (200K tokens), tool-use capabilities, and quality of reasoning justify the cost for most professionals. For simple autocomplete and one-file edits, free tiers of Copilot or Cursor may be sufficient.
→ Next: How to Install Claude Code (Mac, Linux, Windows)