How to Get an Anthropic API Key (Step-by-Step)
How to Get an Anthropic API Key
To get an Anthropic API key, create an account at console.anthropic.com, add a payment method under billing, then generate a key from the "API Keys" section of the console. The key will look like sk-ant-... and you use it in the x-api-key header when calling Claude's API directly.
That's the short answer. The rest of this guide walks through each step in detail, covers the billing requirements people trip over, shows your first working request, and explains when you might want a layer on top of the raw Anthropic key instead of using it directly in production.
Step 1: Create an Anthropic Console Account
Go to console.anthropic.com and sign up with an email address or a Google account. You'll be asked to verify your email and accept Anthropic's usage policies. If you're setting this up for a company, use a work email — it makes it easier to invite teammates to the same organization later.
Step 2: Set Up Billing
This is the step most people miss. Anthropic's API is not free — even the first request requires a funded account. In the console:
- Go to Settings → Billing
- Add a credit card
- Optionally set a monthly spend limit so you don't get surprised by usage
Without billing configured, API calls will fail with an authentication or permission error even if your key looks valid. Anthropic occasionally offers trial credits for new accounts, but these are not guaranteed and vary by region and signup batch — don't plan your launch around them.
Step 3: Generate Your API Key
Once billing is active:
- Go to Settings → API Keys
- Click Create Key
- Give it a descriptive name (e.g.,
prod-backend,local-dev) — this matters once you have more than one key - Copy the key immediately — Anthropic shows the full value only once
The key format is sk-ant-api03-.... Store it in an environment variable, never in source code:
export ANTHROPIC_API_KEY="sk-ant-api03-xxxxxxxxxxxx"
Step 4: Make Your First Request
Here's a minimal request using curl against Anthropic's Messages endpoint:
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-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Say hello in one sentence."}
]
}'
If this returns a JSON response with a content array, your key and billing are working correctly.
Common Setup Mistakes
- Forgetting the
anthropic-versionheader. Requests without it often fail or behave inconsistently across model versions. - Using the key in client-side code. Anthropic API keys are meant for server-side use only. If a key ends up in a browser bundle or mobile app, anyone can extract it and run up your bill.
- No spend limit set. A bug that loops on a prompt can burn through credits fast. Set a monthly cap in billing settings on day one.
- One shared key for the whole team. It works until someone leaves or a key leaks, then you have to rotate it and update every service that used it. Separate keys per environment or service make auditing and revocation far easier.
Rate Limits and Account Tiers
New accounts start on a lower-tier rate limit (requests per minute and tokens per minute). Limits increase automatically as your account accumulates spend and history, or you can request a tier increase through the console if you have a specific launch date. If you're building something that needs predictable throughput from day one, factor this into your timeline — tier upgrades aren't instant.
When You Need More Than a Raw API Key
A direct Anthropic key is the right starting point for prototyping and solo projects. But once you're shipping a product, a few gaps show up:
- You want per-application keys instead of one account-wide secret
- You need usage breakdowns by customer or feature, not just a total bill
- You want to add teammates without sharing the same root key
- You're calling Claude from multiple services and want one place to monitor usage and rotate credentials
This is the gap SubToAPI fills. It sits on top of your Claude access and gives you application-scoped keys (sub_live_...), a dashboard with usage metadata per key, streaming and tool use support, and team seats so colleagues get their own scoped access instead of one shared secret.
Getting started looks similar to the raw Anthropic flow — sign up, get a key, make a request — but the key is scoped to your application rather than your whole account:
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Say hello in one sentence."}
]
}'
You can see the full request/response shape in the docs, and the quickstart walks through setup end to end. There's a free trial at /signup, and plans start at Solo for €9/month, with Team and Scale tiers for growing teams — details on /pricing.
Recap
Getting a raw Anthropic API key takes four steps: create a console account, add billing, generate the key, and make a test request. That's enough to start building. As soon as you're running a real product with multiple services, customers, or teammates, scoped application keys and per-key usage tracking save you from a lot of operational pain later — whether you build that layer yourself or use something like SubToAPI on top of your existing Claude access.
Questions
Do I need a credit card to get an Anthropic API key? Yes. You can create a console account without one, but you can't make successful API calls until billing is configured with a valid payment method.
Is the Anthropic API key the same as a Claude.ai login? No. Your Claude.ai consumer subscription and your Anthropic Console API account are separate systems with separate billing. An API key only comes from the console.
Can I use one Anthropic API key for multiple apps? You can, but it's not recommended. If that key leaks or needs rotation, every app using it breaks at once. Separate keys per app or environment, or a scoped-key layer like SubToAPI, make this much easier to manage.