Anthropic Console API Key Setup: Step-by-Step Guide
If you want to call Claude programmatically, you need an API key from the Anthropic Console — not your regular claude.ai login. This article walks through creating an Anthropic organization, generating an API key, setting spending limits, and making your first authenticated request, plus the common mistakes that trip people up along the way.
The short version: go to console.anthropic.com, create or join an organization, add a payment method, generate a key under API Keys, and store it as an environment variable. The rest of this guide covers each step in detail, including the parts the dashboard doesn't explain well.
Step 1: Create an Anthropic Console account
The Console is a separate product from the consumer Claude.ai chat interface. Having a claude.ai account does not give you API access.
- Go to
console.anthropic.com - Sign up with email or an SSO provider
- Verify your email and complete the organization setup prompt
If you're joining an existing company organization, ask an admin to send you an invite from the Members section instead of creating a new one — API keys are scoped per organization, and you don't want billing split across duplicate orgs.
Step 2: Add a payment method and set limits
The API is pay-as-you-go, billed by token usage, separate from any Claude Pro subscription. Before you generate a key:
- Go to Settings → Billing
- Add a credit card
- Optionally set a usage limit (a hard monthly spending cap) under Settings → Limits
Setting a usage limit is worth doing even in testing — it's the easiest way to avoid a surprise bill if a script gets stuck in a retry loop or a prompt accidentally sends a huge document in every call.
Step 3: Generate the API key
- Go to Settings → API Keys
- Click Create Key
- Give it a descriptive name — something like
local-dev,ci-pipeline, orprod-backend— since you'll likely create several over time - Copy the key immediately; Anthropic shows the full value only once
Keys look like sk-ant-api03-.... Treat them as secrets: don't commit them to git, don't paste them into chat tools, and don't hardcode them in frontend JavaScript where anyone can read them from the browser.
Store the key as an environment variable
export ANTHROPIC_API_KEY="sk-ant-api03-..."
Or in a .env file excluded from version control:
ANTHROPIC_API_KEY=sk-ant-api03-...
Step 4: Make your first request
Test the key with a simple curl call to the Messages API:
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 256,
"messages": [
{"role": "user", "content": "Say hello in one sentence."}
]
}'
If this returns a JSON response with a content array, your key and billing setup are working. If you get a 401, double-check the key was copied in full (no trailing spaces). If you get a 403 or billing error, confirm a payment method is attached and the usage limit isn't already hit.
Step 5: Organize keys by environment and team
Once the first key works, resist the temptation to reuse it everywhere. A cleaner setup looks like:
- One key per environment (
dev,staging,prod) - One key per service if you run multiple backends
- Naming convention in the key description so you can identify it in the usage dashboard later
- Rotation plan — delete and regenerate keys for anyone who leaves the team or any service that's decommissioned
The Console's usage dashboard breaks down spend by key, which is the main way to catch a leaked or misused credential before it becomes expensive.
Where the raw Console key falls short
A raw sk-ant-... key from the Console gives you direct access to Claude, but it doesn't give you much structure around that access. There's no built-in way to:
- Issue separate keys to different apps or customers without creating them manually one by one in the Console
- See per-application usage broken out automatically
- Give a teammate access to usage data without handing them the master key or inviting them to the full organization
If you're building a product that calls Claude on behalf of multiple apps, clients, or team members, it's common to put a thin API layer in front of the Console key rather than distributing the raw key itself. That's the gap SubToAPI fills: it sits on top of your existing Claude access and issues scoped sub_live_... application keys with their own streaming, usage metadata, and seat management, instead of everyone sharing one Console credential. Setup takes the same shape as above — sign up, generate a key, call the API:
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 256,
"messages": [{"role": "user", "content": "Say hello in one sentence."}]
}'
See the quickstart and messages API docs for the full request format, streaming docs for SSE responses, and tools docs for function-calling setups. Plans start at €9/month on the pricing page, with a free trial at signup.
Common setup mistakes
- Using the claude.ai login instead of the Console — they're different systems with different credentials
- Forgetting the
anthropic-versionheader — requests fail without it - Hardcoding keys in frontend code — anyone can view-source and steal them
- No usage limit set — a runaway script can run up a bill before anyone notices
- One shared key across a whole team — makes it impossible to tell who's using what, and a single leak compromises everyone
questions
Do I need a Claude Pro subscription to get an API key? No. The Console API and the Claude.ai chat subscription are billed and managed separately. You only need a Console account with a payment method attached.
Why does my API key return a 401 error even though I copied it correctly? Check for trailing whitespace or line breaks when pasting into environment variables, and confirm you're sending it in the x-api-key header, not Authorization: Bearer, which the native Anthropic API doesn't use.
Can I give my API key to a teammate without sharing my login? Not directly through the Console — keys are tied to the organization, not individual logins, so anyone with the key has full access. If you need scoped, per-person or per-app keys with usage tracking, a layer like SubToAPI's team seats handles that separation.