How to Get a Claude API Key: Step-by-Step Setup in the Claude Console
Create a Claude API key in the Claude Console, add credits, set ANTHROPIC_API_KEY and make a first call. Plus plan vs API billing and key expiration.
Last Updated:

Short answer: Sign in to the Claude Console (Anthropic's developer platform, formerly console.anthropic.com), add credits to your organization, open Settings → API keys, click Create key, and copy the key that starts with sk-ant-api. Put it in the ANTHROPIC_API_KEY environment variable and every official SDK picks it up. A Claude Pro or Max subscription does not include API usage by itself: the API is billed separately.
Key takeaways
- The Claude API key and the Anthropic API key are the same thing. Both names refer to a key from the Claude Console.
- You pay for API calls separately from a Claude plan. Max, Ultra and Team plans include monthly API credits that you claim by linking a Console organization.
- Pick the key type and expiration when you create it. A personal key acts as you, a service account key is for shared workloads, and expiration cannot be changed later.
- One key for several model families. If your agent also needs GPT, Gemini or open models, a gateway such as AIsa gives you Claude through the same Anthropic Messages format plus other models on one key.
Step 1: Sign in to the Claude Console
Go to platform.claude.com and sign up or sign in. The Claude Console is separate from the claude.ai chat app. API keys, usage, billing and workspaces all live in the Console.
Step 2: Add credits
New Console organizations pay in advance. Per Anthropic's help center, you add usage credits to the organization's balance, give some details about your organization and use case, enter payment details and add funds. After that, the API and the Console playground work.
If you have a Claude Max, Ultra or Team plan, you can instead link your Console organization to the plan to claim its monthly API credits, with no payment method required (Anthropic help center).
Step 3: Create the API key
- Open Settings → API keys (
platform.claude.com/settings/keys). - Click Create key and give it a name you will recognize later, such as
support-bot-prod. - Choose an expiration: 3 hours, 1 day, 7 days, 30 days, a custom duration, or Never for keys you keep in a secrets manager. Expiration cannot be changed after creation.
- Set Linked account: yourself for a personal key, or a service account for a key that a team or a production service shares.
- Optionally scope the key to one workspace, so requests do not need an
anthropic-workspace-idheader. - Copy the key and store it right away in a password manager or secrets manager.
Anthropic's authentication docs explain the three key types:
| Key type | Acts as | Stops working when |
|---|---|---|
| Personal key | You, with your roles | You lose access to the organization (or to its only workspace) |
| Service account key | A service account | The service account is archived or removed from the workspace |
| Workspace key (legacy) | The workspace | It expires, is disabled or deleted, or the workspace is archived |
Use a personal key for your own scripts and a service account key for CI and production. Anthropic calls workspace keys legacy.
Step 4: Set the environment variable and make a first call
The SDKs and the ant CLI read the key from ANTHROPIC_API_KEY:
export ANTHROPIC_API_KEY="sk-ant-api03-..."
Then call the Messages API. This request is from Anthropic's get started guide:
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2026-10-21" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 1000,
"messages": [{"role": "user", "content": "Hello, Claude"}]
}'
The API also accepts the key as Authorization: Bearer <key>. In Python:
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1000,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(message.content[0].text)
For local development, Anthropic now also offers a CLI sign-in (ant auth login) that the SDKs pick up without a static key.
What the API costs
API usage is billed per million tokens (MTok). Prices for the current models on Anthropic's pricing page, read on 2026-11-15:
| Model | Input | Output |
|---|---|---|
| Claude Fable 5.2 | $8 / MTok | $40 / MTok |
| Claude Opus 5.5 | $4 / MTok | $20 / MTok |
| Claude Sonnet 5.5 | $2 / MTok | $10 / MTok |
| Claude Haiku 5.5 (prompts up to 100,000 tokens) | $0.10 / MTok | $0.50 / MTok |
Prompt caching lowers the price of repeated input. Check the pricing page for cache prices and older models. For what Fable needs from agent code, such as always-on thinking and refusal handling, see Claude Fable and Mythos for AI agents.
Keep the key safe
- Never put the key in browser code. Anyone can read a key in a web page. Call the API from your back end.
- Store it in a secrets manager and rotate it on a schedule.
- Disable or delete a leaked key. On the API keys page, Disable is reversible and Delete is permanent.
- Limit the damage of a leak with an expiration and an IP allowlist.
- Watch for an exported key in Claude Code. If
ANTHROPIC_API_KEYis set and you approve it, Claude Code uses the key instead of your Claude subscription, and you pay API rates. - Prefer Workload Identity Federation in production on AWS, Google Cloud, Azure, GitHub Actions or Kubernetes. It replaces the static key with short-lived tokens.
Common errors
| Error | Likely cause | Fix |
|---|---|---|
401 authentication_error | Wrong, disabled or expired key | Check the key on the API keys page; create a new one if it expired |
400 invalid_request_error about anthropic-workspace-id | The key is not scoped to a workspace | Add the header, or create a key scoped to one workspace |
| Requests fail with a credit or billing message | No balance on the organization | Add credits, or link a Max, Ultra or Team plan |
401 with CORS requests are not allowed | The call comes from a browser | Move the call to your back end |
Use one key for Claude and other models
A Claude key covers Claude models only. If your agent also calls GPT, Gemini, Qwen or Kimi models, or needs data APIs such as web search, you manage a key and a bill per provider. AIsa puts Claude and 110+ other models, plus 6,000+ APIs, behind one key and one balance.
AIsa serves Claude through the same Anthropic Messages format, so the official SDK works with a different base URL. The base URL has no /v1, because the SDK appends /v1/messages itself (AIsa docs):
import anthropic
client = anthropic.Anthropic(
base_url="https://api.aisa.one",
api_key="YOUR_AISA_API_KEY",
)
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1000,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
Claude Opus 5.5 and Sonnet 5.5 are listed at the same per-token prices as Anthropic's API in the AIsa model catalog. Check the catalog for each model before you switch, because not every price matches: Claude Haiku 5.5 is listed at $0.50 input and $2.50 output per MTok on AIsa. To run Claude Code on AIsa models, see Use AIsa in Claude. Create an AIsa key in the console.
FAQ
Is the Claude API free?
No. The API bills per token from a prepaid balance. Max, Ultra and Team plans include monthly API credits that you claim by linking a Console organization.
Does a Claude Pro subscription include an API key?
No. A paid Claude plan covers the Claude apps, and the API is billed separately in the Claude Console.
Where do I find my existing Claude API key?
The API keys page lists each key's name, status and expiration. If you lost the secret, create a new key, deploy it, and delete the old one.
What is the difference between a Claude API key and an Anthropic API key?
There is none. Anthropic makes Claude, and the key from the Claude Console is called by either name. Code reads it from ANTHROPIC_API_KEY.
Can I use one API key for Claude and GPT?
Not with an Anthropic key. A gateway such as AIsa gives you one key for Claude, GPT and other models.
Sources
- Get started with Claude, Authentication and Pricing, Claude Platform Docs, read 2026-11-15
- Why is Claude API usage billed separately from my paid Claude plan? and Starting with the Claude API, Anthropic help center
- Claude Code overview, Anthropic
- Claude models on AIsa and the AIsa model catalog