Anthropic API Key Format (sk-ant-api03)

Every Anthropic API key starts with sk-ant-api03-. This is a quick breakdown of what each piece means, how to spot a valid key, and the difference between the two token types Anthropic issues (api03 vs oat01).

Anatomy of a key

sk-ant-api03-AAAAAA...BBBBBB (≈95 chars)
sk — "secret key", industry convention (matches OpenAI's sk-).
ant — issuer is Anthropic.
api03 — third-generation API key format. (api01 and api02 existed earlier; all current keys are api03.)
body — random base64url payload, ~95 characters. No checksum — validity only confirmable via an API call.

Total length is about 108 characters. The body is URL-safe so the key can travel in headers and querystrings without escaping, but you should still treat it as a secret and pass it via the x-api-key header, not a URL parameter.

api03 vs oat01 — two token types

Anthropic actually issues two kinds of Bearer tokens. Both work against api.anthropic.com, but they bill different surfaces:

Most third-party hosted-agent platforms only accept the api03 path. Tools that integrate deeply with Claude — Claude Code itself, VibeKit, a few others — also accept oat01 so Pro/Max subscribers can use what they're already paying for.

How to generate one

# For an API key (sk-ant-api03-…):
1. Sign in to console.anthropic.com
2. Settings → API Keys → "Create Key"
3. Name it after the tool you'll use it in (so you can revoke per-tool later)
4. Copy the key once — Anthropic does not show it again
5. Fund the account if it's new — $5+ in credit unlocks production traffic

# For a subscription token (sk-ant-oat01-…):
1. Install Claude CLI: npm i -g @anthropic-ai/claude-code
2. Run: claude setup-token
3. Open the URL it prints, log in to Claude Pro / Max
4. Paste the returned token back into the CLI
5. The token lasts about a year before re-auth is required

Validating a key locally

You can pattern-match the prefix in code without a network call:

function isAnthropicKey(s) {
  return /^sk-ant-(api03|oat01)-[A-Za-z0-9_-]{40,}$/.test(s);
}

To confirm it's actually live and has credit, hit a tiny /messages request:

curl -s https://api.anthropic.com/v1/messages \
  -H "x-api-key: $KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":4,"messages":[{"role":"user","content":"hi"}]}'

A 200 with a small completion confirms the key works. A 401 means revoked or typoed. A 402 means out of credit. A 429 means rate-limited (still a valid key).

Using a key with a hosted AI agent

If you're trying to plug an Anthropic key into an agent so you can build apps without writing infrastructure code, VibeKit is BYOK-first: paste your sk-ant-api03- (or sk-ant-oat01-) into Profile → AI Provider → Anthropic, and the agent's next request runs through your Anthropic account. Charges go straight to Anthropic; VibeKit doesn't bill on top. Free tier is genuinely free with BYOK — no per-session markup, no token clipping.

Security hygiene

FAQ

What does sk-ant-api03 mean?

It's the prefix Anthropic puts on production API keys. sk = secret key, ant = Anthropic, api03 = third generation of their API key format. Every current Anthropic API key starts with these 13 characters, followed by a long random base64url body.

What's the difference between sk-ant-api03 and sk-ant-oat01?

api03 is an API key — bills per token from your console.anthropic.com account. oat01 is an OAuth token from claude setup-token — bills against your Claude Pro or Max subscription quota. Same endpoint, different billing path.

How do I generate an Anthropic API key?

console.anthropic.com → Settings → API Keys → Create. Name it, copy it once, fund the account with credit if it's new. The console shows usage per-key, which is handy for tracking what each tool spends.

Can I use my Anthropic key with VibeKit?

Yes — VibeKit is BYOK-first. Paste either sk-ant-api03 or sk-ant-oat01 into Profile → AI Provider → Anthropic. AI requests go through your Anthropic account; VibeKit doesn't take a cut. More on BYOK →

Why isn't my Anthropic key working?

Five common causes: key was rotated/revoked, account out of credit, rate-limited (429), trailing whitespace from copy-paste, or you're passing an oat01 subscription token to a service that only accepts api03. The curl snippet above will tell you which.

Already have a key? Spin up an app in 30s.

Paste your sk-ant-…, get a persistent AI agent + GitHub repo + live URL. Free tier with BYOK.

Enter VibeKit →