← Blog

Anthropic API Key: What It Is and How to Manage It

2026-08-31 · 5 min read · SubToAPI Team

An Anthropic API key is the credential that lets your code call Claude models programmatically over HTTPS, separate from logging into claude.ai in a browser. It's a string starting with sk-ant- that you generate in the Anthropic Console and pass in an x-api-key header on every request. Without it, there is no way to send messages, stream responses, or use tools through the Anthropic API — a Claude.ai login and an API key are two completely different systems with separate billing.

This article covers what the key actually is, how it's structured, how to keep it secure, and what your options are if console-based pay-as-you-go billing doesn't fit how your team or product needs to work.

What the key represents

When you generate an API key in the Anthropic Console, you're creating a credential tied to a specific workspace inside your organization. That workspace has:

The key itself doesn't encode a plan or a model — it's just an authentication token. What model you can call, how fast, and how much it costs is determined by your account's usage tier and the model you specify in the request body (claude-opus-4, claude-sonnet-4, etc.).

This is different from a ChatGPT Plus or Claude Pro subscription. A consumer subscription gives you a chat interface with fixed monthly pricing. An API key gives you programmatic access billed per token, with no monthly cap unless you set one manually in the console.

Getting an API key

  1. Go to the Anthropic Console and create or select an organization.
  2. Add a payment method — API access requires billing to be set up before any key will work.
  3. Create a workspace (or use the default one).
  4. Under API Keys, generate a new key and copy it immediately — Anthropic only shows the full value once.

A minimal request looks like this:

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-20250514",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Summarize this text in two sentences."}
    ]
  }'

The response is JSON containing the message content, stop reason, and token usage. Streaming, tool calls, and system prompts all use the same key and header pattern — only the request body changes.

Keeping the key secure

Anthropic API keys grant billed access to your account, so treat them like a database password, not a config value.

If you're building a product that calls Claude on behalf of end users, the request should always originate from your backend, with the API key living only on the server.

Where console billing gets awkward

Direct Anthropic API keys work well for a single developer or a small script, but two problems come up as teams grow:

Multiple people need access without sharing one key. The console lets you create multiple keys per workspace, but managing who has which key, tracking their individual usage, and revoking access cleanly when someone leaves is manual work you have to build yourself.

Usage-based billing is unpredictable. Pay-as-you-go pricing is fine for experimentation, but for a product with real usage it means unpredictable monthly invoices and no simple seat-based way to allocate cost across a team.

This is the gap SubToAPI is built for. Instead of provisioning direct Anthropic API keys per developer, you connect your existing Claude access once and issue sub_live_... application keys from one dashboard. Each key can belong to a different teammate or service, usage and streaming metadata is visible per key, and pricing is a flat per-seat rate (Solo €9, Team €19/seat, Scale €49/seat) instead of unmetered token billing. You get the same request/response shape as the Anthropic Messages API, so a client built against it doesn't need architectural changes:

const res = 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-20250514",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Draft a release note for v2.3.0" }]
  })
});

Streaming and tool use work the same way — see /docs/streaming and /docs/tools for the details. If you want to try it before committing, start with /docs/quickstart, or check /pricing to see which tier matches your team size. Signing up takes a couple of minutes at /signup with a free trial before you're billed.

When to use a direct key vs. a managed one

A direct Anthropic API key from the console makes sense if you're a solo developer prototyping, running internal scripts, or need fine-grained control over billing and rate-limit tiers yourself. A managed layer like SubToAPI makes more sense once you have multiple people or services calling Claude and want per-key visibility, predictable seat pricing, and one dashboard instead of coordinating console access for everyone involved.

Where do I get an Anthropic API key?

Create an account and organization at the Anthropic Console, add a payment method, then generate a key under the API Keys section of a workspace. Billing must be active before the key will authenticate requests.

Is an Anthropic API key the same as my Claude.ai login?

No. Claude.ai (or Claude Pro) is a consumer subscription for chat access in a browser. An API key is a separate credential for programmatic access, billed per token through the Anthropic Console, independent of any Claude.ai plan.

What should I do if my API key is exposed?

Revoke it immediately in the Anthropic Console and generate a new one. Check your usage dashboard for unexpected spend during the exposure window, and audit anywhere the key was stored — repos, logs, or client-side code — to prevent it happening again.

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 →