How to get a Claude API key
Create an Anthropic API key for Claude in five steps, add credit, and use it in Claude Code and the Anthropic SDK. Plus what the spend limits are and how to keep a key safe.
Published November 28, 2026
Anthropic's API keys are made in the Claude Console at platform.claude.com. Sign in, open the API keys page, click Create key and copy it: it starts with sk-ant- and is shown only once (Anthropic).
Create the key
- Sign in or sign up at platform.claude.com.
- Open Settings, then API keys.
- Click Create key. Give it a name, pick when it expires and, if you use them, a workspace.
- Copy the key. Anthropic shows it only once; if you lose it, make a new one.
- Put it in your environment, where the Anthropic SDKs and Claude Code look for it:
export ANTHROPIC_API_KEY=sk-ant-...Add credit
- Anthropic's API is prepaid. Buy credits under Settings, Billing; it takes the Admin or Billing role. Credits expire a year after you buy them, and purchases aren't refunded (Anthropic).
- New users get some free credits to test the API; Anthropic doesn't say how much (Anthropic).
- Each account has a monthly spend limit: $500 on the Start tier, $1,000 on Build and $200,000 on Scale. Past it, requests are refused until the first of the next month (Anthropic). Tiers move up with use, not with deposits (Anthropic).
Use it
- Claude Code uses
ANTHROPIC_API_KEYin place of a Claude plan, even while you're logged in, and asks you to approve the key once (Anthropic). - The Anthropic SDKs for Python, TypeScript and other languages read the same variable, so
Anthropic()needs no arguments.
Keep it safe
- Keep the key out of code you commit. A project's
.claude/settings.jsonis usually committed, so put keys in your environment or in~/.claude/settings.json. - Give each app or person a key of its own, so you can revoke one without stopping the rest.
- Set the shortest expiry that works, and delete keys you no longer use.
A key for Claude at a lower price
A /model key works in the same places, Claude Code and the Anthropic SDKs included, and costs less per token:
Claude prices here
Prices as of Nov 30, 06:38 PM UTCPer 1M tokens, input / output, at the cheapest channel serving each model now.
- Claude Opus 5.5Anthropic's price:
$4.00 / $20.00Here: $0.55 / $2.7586% off - Claude Sonnet 5.5Anthropic's price:
$2.00 / $10.00Here: $0.275 / $1.37586% off - Claude Haiku 5.5Anthropic's price:
$0.10 / $0.50Here: $0.033 / $0.16367% off - Claude Fable 5.2Anthropic's price:
$8.00 / $40.00Here: $2.60 / $13.0067% off
To set it up, follow the Claude Code guide. You need a /model API key from the API keys page.
Sources
Each opened on November 28, 2026.