← Blog

How to Create a Claude AI API Key: Full Setup Guide

2026-09-04 · 5 min read · SubToAPI Team

Creating a Claude AI API key means generating a credential in Anthropic's Console that lets your code send requests to Claude programmatically instead of through the chat interface. You need one to build anything that calls Claude from a script, backend service, or app — chatbots, content pipelines, internal tools, whatever you're building.

The process itself takes about five minutes: create an account, add billing, generate a key, and test it with a single request. The parts people actually get stuck on are billing setup, key security, and understanding what happens after the key exists — rate limits, usage tracking, and how to manage access if more than one person on your team needs it. This guide covers all of that.

Step 1: Create an Anthropic Console Account

Go to the Anthropic Console (console.anthropic.com) and sign up with an email address or Google account. This is separate from a Claude.ai chat subscription — a Claude Pro or Max plan does not give you API access. The Console is where developer accounts and billing live.

Once you're in, you'll land on the dashboard for your "Workspace" — Anthropic's term for an isolated environment with its own keys, usage, and members.

Step 2: Add Billing Information

The API runs on prepaid or postpaid credits, not a flat subscription. Before you can generate a working key, go to Settings → Billing and add a payment method. Anthropic typically requires a minimum initial credit purchase (this amount has changed over time, so check the current figure in the Console).

Without billing set up, you can still generate a key, but every request will fail with a billing-related error. This trips up a lot of first-time users who think the key itself is broken.

Step 3: Generate the API Key

  1. In the Console sidebar, go to API Keys.
  2. Click Create Key.
  3. Give it a descriptive name — something like prod-backend or local-dev so you can tell keys apart later.
  4. Copy the key immediately. It's shown in full only once; after you navigate away, the Console only displays a truncated version.

The key will look something like sk-ant-api03-.... Store it somewhere safe — a password manager or your local .env file, never in a Git repository.

# .env
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here

Step 4: Send a Test Request

Confirm the key works before wiring it into a larger project:

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

A successful response returns a JSON object with a content array containing Claude's reply. If you get a 401, double-check the header name — it's x-api-key, not Authorization: Bearer. If you get a billing error, go back to Step 2.

Step 5: Keep the Key Secure

A few basics that save you from expensive mistakes:

What to Do If You Need Team Access or a Simpler Setup

Anthropic's Console works well for a single developer or a small team comfortable managing raw API keys, billing, and rate limits directly. It gets more complicated once you need multiple people issuing requests under shared oversight, per-key usage breakdowns, or a way to onboard teammates without handing out the master key.

If that's your situation, SubToAPI (https://subtoapi.app) sits on top of your existing Claude access and gives you application-scoped keys (sub_live_...) instead of one shared credential. Each key can be issued per project or per team member, with usage metadata visible per key in one dashboard — useful if you're billing clients per project or just want to know which service is generating the most token usage. It also handles streaming and tool use the same way the native API does, so switching doesn't mean rewriting your integration logic.

Signing up takes about the same five minutes as the Console setup above — create an account, grab a key, and check the quickstart for the request format. If you're comparing costs, pricing starts at €9/month for a solo plan and scales to per-seat pricing for teams.

const response = await fetch("https://api.subtoapi.app/v1/messages", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SUBTOAPI_KEY}`,
    "content-type": "application/json"
  },
  body: JSON.stringify({
    model: "claude-sonnet-4-5",
    max_tokens: 100,
    messages: [{ role: "user", content: "Say hello in one sentence." }]
  })
});

For streaming responses or function-calling setups, the streaming docs and tools docs cover the request shape in detail — it mirrors Anthropic's Messages API closely enough that existing code usually needs only a base URL and header change.

Choosing Between the Two Approaches

If you're a solo developer building a personal project or prototype, generating a key directly in the Anthropic Console is the fastest path — no extra layer, no additional cost beyond usage. If you're building something that multiple people or services will call, need clearer per-key usage visibility, or want team seat management without building your own admin panel, a layer like SubToAPI removes that overhead.

Either way, the underlying request format is nearly identical, so you're not locking yourself into a hard decision — you can start with a raw Console key and add a management layer later without rewriting your integration.

questions

Do I need a Claude Pro subscription to get an API key? No. API access and Claude.ai chat subscriptions are entirely separate products with separate billing. You can have an API key without ever subscribing to Claude Pro or Max.

Why does my new API key return a billing error? Anthropic requires an active payment method and initial credit balance before keys become functional. Add billing details in the Console's Settings before testing requests.

Can I have multiple API keys on one account? Yes. You can generate as many keys as you need, each with its own name, and revoke individual keys without affecting others — useful for separating dev, staging, and production environments.

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 →