← Blog

How to Get an Anthropic API Key: Step-by-Step

2026-09-02 · 4 min read · SubToAPI Team

Getting an Anthropic API key means creating an account on the Anthropic Console, setting up billing, and generating a key that starts with sk-ant-. That key is what you put in your x-api-key header when calling Claude programmatically instead of using the chat interface.

This guide walks through the exact steps, what to do once you have the key, and a couple of things that trip people up — like billing setup and key management once you have more than one project using Claude.

Step 1: Create an Anthropic Console account

Go to the Anthropic Console (console.anthropic.com) and sign up with an email address or a Google account. This is a separate account system from claude.ai — a Claude Pro or Max subscription does not give you API access or an API key. The console is specifically for developers building on the API.

Verify your email if prompted, then you'll land on the console dashboard.

Step 2: Add a payment method

Unlike claude.ai's flat subscription, the API is pay-as-you-go. Before you can generate a working key, you need to:

  1. Go to Settings → Billing
  2. Add a credit card
  3. Optionally load prepaid credits or set a monthly spend limit

You typically get a small amount of free trial credit on signup, enough to test the API before committing to real spend. Once that's used up, calls will fail until billing is set up.

Step 3: Generate the API key

  1. Navigate to Settings → API Keys
  2. Click Create Key
  3. Give it a descriptive name (e.g., prod-backend, local-dev)
  4. Copy the key immediately — it starts with sk-ant- and is shown only once

If you lose it, you can't retrieve it again — you have to revoke it and generate a new one. Store it in a secrets manager or .env file, never in source control.

Step 4: Make your first API call

With the key in an environment variable, test it with curl:

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-opus-4-1-20250805",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

If you get a JSON response with a content array, the key works. A 401 means the key is wrong or missing; a 403 usually means billing isn't set up yet.

Step 5: Set spend limits and rotate keys

Once the key is live, two things matter for staying safe:

Anthropic's console also shows usage broken down by key, which helps you spot which key is burning through credits if something looks off.

Where this gets harder at scale

A raw Anthropic API key works fine for a single developer hitting the API from one service. It gets messier once you have:

That's the gap SubToAPI fills. Instead of managing raw Anthropic keys per project, you generate sub_live_... application keys from one dashboard, each scoped to its own usage metadata, while the underlying Claude access stays centralized. Streaming and tool use work the same way they would against the Anthropic API directly — see the streaming docs and tool use docs — but you get team seats and per-key usage without building that layer yourself.

Getting started looks similar to the steps above: sign up, grab a key from the dashboard, and send your first request per the quickstart:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-opus-4-1-20250805",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

Plans start at Solo €9 for individual use, with Team (€19/seat) and Scale (€49/seat) tiers for shared usage and higher limits — details on the pricing page. Full request and response formats are in the messages docs.

Common mistakes to avoid

questions

Do I need a separate account to get an Anthropic API key if I already pay for Claude Pro? Yes. Claude Pro and Max are consumer subscriptions on claude.ai; the API requires a separate Anthropic Console account with its own billing.

Is the Anthropic API key free to use? New accounts usually get a small amount of free trial credit, but ongoing use is billed per token based on the model you call — it's not a flat free tier.

Can I use one Anthropic API key across multiple projects? Technically yes, but it's not recommended — separate keys per project or environment make usage tracking and revocation much easier if something goes wrong.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →