APIMODELSAPIMODELS

Claude API key: how to get one and how to use it

Updated 2026-11-19

TL;DR Short answer: sign in to the Claude Console at platform.claude.com, create a key under Settings, API keys (platform.claude.com/settings/keys), and set it as ANTHROPIC_API_KEY. API usage is billed per token, separately from any Claude.ai subscription. If you would rather skip the Anthropic account, an APIMODELS key calls the same Claude models on the same Messages API, at 40% below list for Fable 5.2, Opus 5.5 and Sonnet 5.5.

A Claude API key is the secret that lets your code, scripts and tools such as Claude Code call Anthropic's Messages API. It is not the same as a Claude.ai login: the subscription you use in the Claude app does not include API usage, which Anthropic bills separately per token.

Below: the exact steps to create one, where to find it later, how to use it in code and in Claude Code, and when a single APIMODELS key is the simpler option. Steps checked against Anthropic's get-started guide on 19 November 2026.

How to get a Claude API key from Anthropic

1. Create or sign in to a Claude Console account at platform.claude.com.

2. Open Settings, then API keys (platform.claude.com/settings/keys) and create a key. Give it a name you will recognise later.

3. Copy it somewhere safe right away, such as a password manager.

4. Set it as an environment variable: the official SDKs and the ant CLI read ANTHROPIC_API_KEY, for example export ANTHROPIC_API_KEY="your-api-key-here".

5. Send a test request to https://api.anthropic.com/v1/messages with the key in the x-api-key header.

Where to find your Claude API key later

Your keys are listed in the Claude Console under Settings, API keys. If you cannot find the value of a key you created earlier, create a new key, update it wherever you use it, and delete the old one. On APIMODELS your keys live in the console under API Keys.

Is the Claude API free?

The API is billed per token. A paid Claude.ai plan does not cover it: Anthropic states that the API is billed separately from the subscription. Max, Ultra and Team plans do come with monthly API credits ($100, $200 and up to $500 pooled), but those credits do not cover interactive Claude Code sessions and do not roll over.

Using a Claude API key in Claude Code

Claude Code reads two variables, and they send the key in different headers: ANTHROPIC_API_KEY goes in x-api-key, ANTHROPIC_AUTH_TOKEN goes in Authorization: Bearer. With an Anthropic key, ANTHROPIC_API_KEY is the usual choice. In interactive mode Claude Code asks you once to approve the key, and after that it overrides your Claude subscription, so usage is charged at API rates.

Put the key in the env block of ~/.claude/settings.json if you want it to apply however claude is launched, and never in a project's .claude/settings.json, which tends to get committed. Run /status to see which credential Claude Code is actually using; a forgotten ANTHROPIC_API_KEY in your shell is a common reason for surprise API charges.

Using one APIMODELS key instead

An APIMODELS key works anywhere an Anthropic key does once you change the base URL to https://api.apimodels.app: the Anthropic SDKs, Claude Code and tools built on the Messages API. It accepts the x-api-key header and Authorization: Bearer. You do not need an Anthropic account, the same key also calls GPT, Gemini, image and video models, and every current Claude model runs on at least two upstream routes that take over automatically if the first one fails before answering. Failed requests are not charged.

ModelAnthropic list (input / output per 1M tokens)APIMODELS (input / output per 1M tokens)Call name
Claude Fable 5.2$8 / $40$4.80 / $24claude-fable-5-2
Claude Opus 5.5$4 / $20$2.40 / $12claude-opus-5-5
Claude Sonnet 5.5$2 / $10$1.20 / $6claude-sonnet-5-5
Claude Haiku 5.5 (prompts up to 100K tokens)$0.10 / $0.50$0.09 / $0.45claude-haiku-5-5

Quick start

~/.claude/settings.json (Claude Code + APIMODELS)

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.apimodels.app",
    "ANTHROPIC_AUTH_TOKEN": "sk_...your_apimodels_key...",
    "ANTHROPIC_MODEL": "claude-opus-5-5"
  }
}

cURL

curl https://api.apimodels.app/v1/messages \
  -H "x-api-key: $APIMODELS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 512,
    "messages": [{"role": "user", "content": "Say hello in three languages."}]
  }'

Python

import anthropic

client = anthropic.Anthropic(
    base_url="https://api.apimodels.app",   # leave this out to call Anthropic directly
    api_key="sk_...your_apimodels_key...",  # or read ANTHROPIC_API_KEY from the environment
)

msg = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=512,
    messages=[{"role": "user", "content": "Say hello in three languages."}],
)
print(msg.content[0].text)

FAQ

How do I get a Claude API key?

Sign in to the Claude Console at platform.claude.com, open Settings, API keys (platform.claude.com/settings/keys) and create a key. Copy it right away and set it as ANTHROPIC_API_KEY. API usage is billed per token, separately from a Claude.ai subscription.

Where do I find my Claude API key?

In the Claude Console under Settings, API keys. If you no longer have the full value of an existing key, create a new one, replace it wherever it is used, and delete the old key.

Is the Claude API free?

No, it is billed per token and is not included in Claude.ai subscriptions. Max, Ultra and Team plans include monthly API credits of $100, $200 and up to $500 pooled, but those credits do not cover interactive Claude Code sessions and do not roll over.

Can I use a Claude API key with Claude Code?

Yes. Set ANTHROPIC_API_KEY (sent as x-api-key) or ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer). Claude Code asks you to approve the key once, then it overrides your subscription and bills at API rates. Run /status to confirm which credential is active.

Can I call Claude without an Anthropic account?

Yes, through a provider that serves the Claude models on the Messages API. On APIMODELS you create a key in the console, set the base URL to https://api.apimodels.app, and call claude-opus-5-5, claude-sonnet-5-5 and the other Claude models with the same requests, at 40% below list for Fable 5.2, Opus 5.5 and Sonnet 5.5.

Related

Featured on
APIMODELS on Product HuntAPIMODELS featured on ToolifyAPIMODELS featured on There's An AI For That