← Blog

Anthropic Console API Key Setup: Step-by-Step Guide

2026-11-23 · 5 min read · SubToAPI Team

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.

  1. Go to console.anthropic.com
  2. Sign up with email or an SSO provider
  3. 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:

  1. Go to Settings → Billing
  2. Add a credit card
  3. 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

  1. Go to Settings → API Keys
  2. Click Create Key
  3. Give it a descriptive name — something like local-dev, ci-pipeline, or prod-backend — since you'll likely create several over time
  4. 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:

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:

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

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.

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 →