How to Get a Claude API Key (Step-by-Step, 2026)

⏱ 5 min read

Updated November 2026. A Claude API key lets your own apps, scripts and tools talk to Anthropic’s Claude models. You need one to build Claude into a website, connect it to automation tools such as Zapier or n8n, or use apps that ask you to “bring your own key”. Getting a key takes about five minutes. Using it costs money, because the API is billed separately from Claude’s chat plans.

What you need

  • An email address or Google account
  • A phone number for verification
  • A payment card to buy API credits

How to get a Claude API key: step by step

Step 1: Open the Claude Console

Go to platform.claude.com, Anthropic’s developer console. The old address, console.anthropic.com, redirects there. This is a separate area from claude.ai, where you chat with Claude.

Step 2: Create an account or sign in

Sign up with your email or Google account. You may be asked to verify your phone number and give some details about how you plan to use the API.

Step 3: Add credits

Open Billing in the Console and add a payment method. The API uses prepaid credits: you buy credits in advance and each request draws them down. Start small, for example $10 to $25, while you test. You can also turn on auto-reload so your apps do not stop when credits run out.

Step 4: Create the key

Open API Keys in the sidebar and click Create Key. Give it a name that says where it will be used, such as “website-chatbot” or “n8n-automation”, and choose a workspace if your organisation uses them. Click Add or Create.

Step 5: Copy and store the key safely

Your key starts with sk-ant-. Copy it straight away, because the Console will not show the full key again. Store it in a password manager or your hosting platform’s secrets settings. On your own computer, the usual approach is an environment variable named ANTHROPIC_API_KEY, which Anthropic’s official SDKs read automatically.

Test your key

To check the key works, run this in a terminal on Mac or Linux after setting ANTHROPIC_API_KEY. Replace MODEL_ID with a current model name from the models overview in Anthropic’s documentation.

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": "MODEL_ID", "max_tokens": 200, "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'

If you get a reply from Claude, your key and billing are set up. An “authentication_error” means the key was copied wrongly. A billing error means you need to add credits.

How much does the Claude API cost?

You pay per token, which is roughly three-quarters of a word. Input (what you send) and output (what Claude writes) are priced separately. Current list prices per million tokens:

Model Input Output Good for
Haiku 5.5 (up to 100K tokens) $0.10 $0.50 Fast, high-volume tasks
Sonnet 5.5 $2 $10 Most apps and coding
Opus 5.5 $4 $20 Complex reasoning and agents
Fable 5.1 $10 $50 The hardest problems

Batch processing is 50% cheaper for jobs that do not need an instant answer, and prompt caching cuts the cost of repeated context. New to tokens? Read what AI tokens are and why they matter.

Is there a free Claude API key?

Not in the usual sense. API usage is paid, and a Claude Pro subscription does not include API access. Two exceptions are worth knowing:

  • Claude Max and Ultra now include $100 and $200 of API credits each month.
  • Claude Team includes pooled API credits of up to $500 a month.

For details on what each plan includes, see Is Claude free?

Keep your API key safe

  • Never put the key in website code that runs in the browser or in a mobile app. Anyone can extract it. Call the API from your server instead.
  • Never commit it to GitHub. Add your .env file to .gitignore.
  • Use one key per project so you can revoke one without breaking everything else.
  • Set spend limits in the Console to cap your monthly bill.
  • Revoke and replace the key immediately if you think it has leaked.

Common problems

“Invalid API key” or authentication error

Check that you copied the whole key with no spaces, and that the environment variable is set in the same terminal or app that makes the request.

“Credit balance too low”

Add credits under Billing. New credits can take a minute to show up.

Rate limit errors (429)

New accounts start on lower rate limits, which rise automatically as you spend more over time. Retry with a short delay, and check your current tier under Limits in the Console.

What to build next

Once your key works, you can connect Claude to no-code tools, build a chatbot, or create an agent that completes multi-step tasks. Our guide on how to make an AI agent walks through both no-code and code options. If you want Claude to write code on your computer instead, install Claude Code, which works with a Claude subscription or an API key.

Comparing providers? Our guide to getting a free Gemini API key covers Google’s option.

Frequently asked questions

Is the Claude API key the same as my Claude login?

No. Your claude.ai account is for chatting with Claude. API keys are created in the Claude Console and are billed separately.

Can I use my Claude Pro subscription for the API?

No. Pro covers Claude’s apps and Claude Code, not API calls. Max, Ultra and Team plans include some monthly API credits.

Where do I find my existing API keys?

In the Claude Console under API Keys. You can see names and usage, but not the full key. If you have lost a key, create a new one and delete the old one.

How do I stop unexpected charges?

Set a monthly spend limit in the Console, keep auto-reload off while testing, and use separate keys for each project so you can see what is using credits.

Prices are Anthropic’s list prices in US dollars, checked in November 2026. See Claude’s pricing page for the latest rates.

Find the right AI tool

Browse our curated directory of AI tools by category.

Explore AI tools →

Explore AI tools by category

Scroll to Top