Free resources · Getting started
Is Claude Code free? And can a stray API key bill you instead of your plan?
Is Claude Code free? Not on the free plan, and "free Claude Code" guides swap in another company's model. Here is how a stray API key in your terminal can bill you instead of your plan, and how to check for one with a made-up key in a throwaway terminal window.
Is Claude Code free?
Not on a free plan. Claude Code needs "a Pro, Max, Ultra, Team, Enterprise, or Console account. The free claude.ai plan does not include Claude Code access". Installing it costs nothing. The cheapest plan that includes it is Pro, at $20 a month. Claude Code comes with it, so you do not need a separate API account on top.
Guides that promise free Claude Code point the tool at another company's model. Claude is then not the model doing the work, so you never get to try what you came to test. In our view this is a different product wearing Claude Code's interface.
Programs talk to Claude directly through the Claude API, and you pay per use. API accounts, API keys and their bills all live in the Claude Console at platform.claude.com. A Console account is billed separately from your claude.ai plan. An API key is a long secret string that tells Anthropic which account to charge.
If you have not installed Claude Code yet, follow How to use Claude Code first.
Can an API key in your terminal replace your plan?
An environment variable is a named setting your terminal hands to every program it starts. If your computer has one named ANTHROPIC_API_KEY (often left over from a tutorial or another tool), Claude Code asks once whether to use it. Say yes and it uses the key instead of your plan, so every request is billed per token to that key's Console account. When Claude Code runs one prompt and exits, with claude -p, "the key is always used when present".
Paid by the token, the same work can cost far more than a plan: about $150 to $300 a month of mostly Haiku use, or about $2,000 of tokens a week for heavy daily use against a $200-a-month plan.
Try the check first in one throwaway terminal window on a Mac or Linux, with a made-up key set in it (never a real one):
export ANTHROPIC_API_KEY="made-up-key-for-this-test"
Do not start Claude Code in that window; it would ask about the made-up key.
Then run this in the same window. It tells you whether the key is set without printing it:
printenv ANTHROPIC_API_KEY >/dev/null && echo "set" || echo "not set"
Close that window when you are done. Then run the same line in a new terminal window to check your real setup.
If a new window prints set and you meant to use your plan, run unset ANTHROPIC_API_KEY, then type /status inside Claude Code to see which login it uses. If a new window still prints set after that, the key is saved in your shell profile (~/.zshrc or ~/.bashrc): delete its export line there, then open a new window. If you said yes to the key before, Claude Code remembers that; the Use custom API key toggle in /config turns it off while the key is set.
Where is the full answer?
- How to use Claude Code
- For what each Claude app plan costs and how its usage limit works, see Claude pricing.
- For what a company gets with Team seats, and when Enterprise is worth a look, see the Claude Team plan.
- Before you pay, read installing Claude Code.
- A price or plan change shows first in the Claude Code changelog.
- What skills are and when Claude Code loads them: our guide to skills.
- Claude Max vs Amazon Ergo pricing
Check your setup before you pay
- In the throwaway window, the check prints
set, because that window holds the made-up key. - In a new window,
not setmeans no key in this terminal's environment can take over your plan. If it printssetwhen you meant to use your plan, Claude Code can bill that key per use instead. - Type /status inside Claude Code to confirm which login is in use; when a login and an API key are both set up, it marks the one that is not in use.