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. Anthropic gives new API accounts a small amount of free credit to test with, but there is no free tier beyond that grant — once it is spent, every call is billed.
What that costs you depends entirely on which of two payment routes you take — a claude.ai subscription or an API key billed per token — and they suit very different usage patterns. The cheapest way to run it without a subscription is a pay-as-you-go key: on Kunavo every Claude model is 30% under Anthropic's list, from a $10 top-up with no monthly fee, and the setup is a few environment variables (below). 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 one free way in is a guest pass. Eligible Pro and Max subscribers can share passes that give someone new to Claude's paid plans a seven-day Pro trial, Claude Code included; senders find them with the /passes command. Passes are limited and can expire, so they are a way to try Claude Code, not a way to keep using it for free (Anthropic's guest pass article, read 2026-10-10). The Free plan itself does not include Claude Code.
Codex is the opposite case: ChatGPT's Free plan includes Codex in the desktop app, with limits. The side-by-side is in is Codex free.
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-5:
| Workload | Kunavo | At Anthropic list |
|---|---|---|
| One agentic step | $0.043 | $0.062 |
| A 20-step task | ~$0.87 | ~$1.24 |
| A heavy day (5 tasks) | ~$4.34 | ~$6.20 |
| 20 such days | ~$87 | ~$124 |
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, or see Claude Code pricing for the subscription tiers, the full per-model rate table and the break-even between the two routes. The “At Anthropic list” column above comes from Anthropic's official API pricing, which carries the current per-token list price for every Claude model next to what the same model costs here.
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-5
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5Same models, same CLI, about 30% off list on the mainline model. Keep the model lines: Claude Code's built-in default and its opus and sonnet aliases follow Anthropic's newest models, and if Kunavo does not serve one yet, the request returns 404. The sonnet alias asks for Sonnet 5.5, which Kunavo does not serve, so /model sonnet, the execution phase of opusplan and subagents set to sonnet return a 404 unless ANTHROPIC_DEFAULT_SONNET_MODEL pins it. The opus pin is Opus 5.5, which needs Claude Code v2.1.280 or later — run claude update on an older install. Pay-as-you-go from a $10 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. If you are already on a plan and keep hitting its window, what happens when you hit a Claude limit does the break-even arithmetic for keeping the plan and adding a key for the hours it has stopped serving.
Four levers that actually move the number
- Keep the Haiku line. Without
ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5, Claude Code'shaikualias asks for a model id Kunavo does not serve (Haiku 5.5 from v2.1.293), so/model haikuand subagents set tohaikureturn 404. With it, the calls Claude Code makes on its own for summaries and titles run on the cheapest model ($0.70 / $3.50 per 1M) instead of the main one — the Anthropic Claude API price list has the per-model rates this trades between, official and discounted side by side. - 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.70 / $3.50 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.
Frequently asked questions
Is Claude Code free?
The Claude Code CLI is free to install, but running it is not — every action it takes is a model call that has to be paid for. You pay one of two ways: a claude.ai subscription (Pro or Max), which includes Claude Code usage within that plan's limits, or an API key billed per token with no monthly fee. There is no free tier that lets Claude Code call a model at no cost.
Can I use Claude Code without a subscription?
Yes — with an API key instead. Claude Code accepts a key billed per token, which suits irregular use because you pay nothing in the months you don't code. Setting a key also parks any claude.ai subscription: while the credential variable is set, the plan's limits stop applying and usage bills to the key instead.
What does Claude Code actually cost per month?
It depends on how many agentic steps you run, not on how many days you use it. A typical step is about 25,000 input and 1,200 output tokens; a 20-step task is roughly $0.87 on Claude Sonnet 5 at Kunavo rates versus about $1.24 at Anthropic's list price. Light use lands in single-digit dollars a month; heavy daily use — five such tasks a day for 20 days — is about $87.
Is there a free trial for Claude Code?
Only by invitation. Eligible Pro and Max subscribers can send guest passes, and a guest pass gives someone who is new to Claude's paid plans seven days of Pro, which includes Claude Code. Without an invite there is no free way to run it: the CLI installs for free, but the first real prompt needs a paid plan or a funded API key, and a small pay-as-you-go top-up with no monthly fee is the lowest-commitment way to try it.
What is the cheapest way to run Claude Code?
Point it at a cheaper endpoint. Claude Code reads ANTHROPIC_BASE_URL natively, so a gateway needs no extra software; on Kunavo the same Claude models run about 30% under Anthropic's list price. Keep ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5 in that setup: without it, Claude Code's haiku alias asks for a model id Kunavo does not serve, so /model haiku and subagents set to haiku return 404. The same line moves Claude Code's automatic background calls from the main model to the cheapest one.
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. If you haven't installed the CLI yet, install Claude Code has the command for each OS.