The Claude Code CLI is free to install. Running it is not. Every action Claude Code takes — reading a file, proposing an edit, running a command, checking the result — is a model call that someone pays for. There is no free tier that lets it call a model at no cost.
What that costs you depends entirely on which of two payment routes you take, and they suit very different usage patterns. Here is the actual arithmetic.
What's free and what isn't
| Component | Cost |
|---|---|
| Installing the CLI | Free |
| The VS Code and JetBrains extensions | Free |
| Config, hooks, skills, subagents, MCP servers | Free |
| Model calls — i.e. actually using it | Paid |
The two ways to pay
| Subscription | API key | |
|---|---|---|
| Billing | Flat monthly (Claude Pro or Max) | Per token, no monthly fee |
| Limits | Usage caps per window | None — you pay for what you use |
| Quiet month | Still charged | Charged nothing |
| Heavy month | Capped, but you hit limits | Scales up with the work |
| Best for | Daily, predictable use | Irregular or bursty use |
The two don't stack, and it matters which one is active: while a credential variable such as ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY is set, Claude Code uses it instead of a saved claude.ai login. Your subscription stays parked and unused, its limits stop applying, and usage bills to the key. Unset the variable and Claude Code goes back to the subscription. Run /status to see which is live right now.
What a real month costs
Cost tracks agentic steps, not calendar days. Claude Code resends the system prompt, the conversation and fresh file context on every step, so a step is bigger than a chat message — around 25,000 input and 1,200 output tokens is typical. At Kunavo rates on claude-sonnet-4-6:
| Workload | Kunavo | At Anthropic list |
|---|---|---|
| One agentic step | $0.037 | $0.093 |
| A 20-step task | ~$0.74 | ~$1.86 |
| A heavy day (5 tasks) | ~$3.72 | ~$9.30 |
| 20 such days | ~$74 | ~$186 |
Those are unoptimised numbers — no prompt caching, everything on the mainline model. Light or exploratory use lands in single-digit dollars a month; the row that hurts is sustained daily agentic work, which is exactly where the per-token rate compounds. Run your own numbers in the cost calculator.
The cheapest way to run it
Claude Code reads ANTHROPIC_BASE_URL natively, so it works against any endpoint serving the Anthropic Messages API — no plugin, no patched binary, no proxy to babysit. That is the supported route to a lower per-token rate:
export ANTHROPIC_BASE_URL=https://api.kunavo.com
export ANTHROPIC_AUTH_TOKEN=sk-kn-...
export ANTHROPIC_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5Same models, same CLI, about 60% off list on the mainline model. Pay-as-you-go from a $5 top-up, no monthly fee, and the balance doesn't expire — so a quiet month genuinely costs nothing. Full walkthrough in the Claude Code setup guide.
Four levers that actually move the number
- Route background work to Haiku. Claude Code makes its own calls for summaries and titles.
ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5($0.40 / $2.00 per 1M) moves them to the cheapest model. One line, permanent saving. - Start fresh tasks. Context is resent every step, so one long-running session is quadratically expensive. A new task is a small context again.
- Let prompt caching work. Cached input bills at 10% of the input rate. On a loop that resends a stable prefix every step that's the single biggest saving available (how it works).
- Cap the key. Give the editor its own key with a spend limit in the dashboard. A runaway loop becomes a capped one instead of a surprise.
Things people get wrong about this
“Claude Code is open source, so it's free”
The client being free to install says nothing about the model calls. The CLI is the cheap part; inference is the cost.
“My Claude Pro subscription covers the API”
It doesn't. Subscriptions and API keys are separate products with separate billing — claude.ai handles one, console.anthropic.com the other. Pro funds Claude Code through the subscription route only, not through a key.
“There must be a free tier if I use a small model”
Cheaper, not free. claude-haiku-4-5 at $0.40 / $2.00 per 1M is a fraction of Sonnet, but it still bills.
“A gateway means I can use it without paying Anthropic”
You're still paying for inference — just at a different rate, to a different party. What changes is the price and the billing model, not whether it costs money.
FAQ
Can I try Claude Code without committing to a subscription?
Yes — a pay-as-you-go key is the lowest-commitment option, since a small top-up carries no monthly fee and no expiry. You can also install the CLI and explore its config, skills and commands before funding anything; only the first real prompt needs a credential.
Which is cheaper for me, subscription or API?
Rough rule: if you'd hit subscription limits most days, the flat fee wins. If you code in bursts — some weeks heavy, some weeks not at all — per-token wins, because the quiet weeks cost nothing. Estimate your own break-even with the cost calculator.
Does using a gateway break anything?
Coding, tools, subagents, MCP and prompt caching all work normally. Remote Control and voice dictation don't — both need a claude.ai identity and are unavailable while a gateway credential is set. The full list is in the setup guide.
How do I set the key up?
See getting an API key for Claude Code — where to create it, which variable to put it in, and why the wrong one fails silently.