The Claude API is how software talks to Claude: your own program sends requests to Claude and pays per token used, instead of you typing in a chat and paying a monthly flat fee. You create the Claude API key you need in the Claude Console at platform.claude.com/settings/keys; it starts with sk-ant- and is shown exactly once. As of October 26, 2026, Anthropic's prices per million tokens are 4 dollars input and 20 dollars output for Opus 5.5, 2 and 10 dollars for Sonnet 5.5, from 0.10 and 0.50 dollars for Haiku 5.5, and 10 and 50 dollars for Fable 5.1. Prompt caching and the Batch API cut the bill considerably. New since October 7, 2026: Max plans include 100 dollars (Max 5x) or 200 dollars (Max 20x) of API credits per month, Team plans 20 dollars per Standard seat and 100 dollars per Premium seat, capped at 500 dollars for the whole team. For your daily work in the chat or in Claude Code, on the other hand, you do not need the API.
I work with Claude Code on a subscription, not through the API, and so does my team of AI employees. That is exactly why it pays to draw the line clearly: it is easy to end up on the API when you actually wanted a subscription, or the other way round. Which plan you need is covered in Claude Pricing and Plans Explained. This article is about the route for your own applications.
Claude API or subscription: the difference
For the API and the Console, Anthropic now speaks of the Claude Platform; the documentation calls the keys “Claude API keys”, also known as “Anthropic API keys”. They mean the same thing. Which models exist and what they are for is covered in Claude Models: Opus, Sonnet, Haiku, Fable.
Create a Claude API key: four steps
The steps come from Anthropic's guide “Get your Claude API key”, as of October 26, 2026:
- Sign in to the Claude Console. Log in at platform.claude.com or create an account.
- Open the API keys page. It lives at platform.claude.com/settings/keys.
- Create the key. Click “Create key”, give it a name, choose an expiration and set “Linked account” to yourself or a service account. Pick a workspace right away: according to the documentation, a key that is not scoped to a workspace needs the workspace ID sent with every request.
- Copy and store the key. The Console shows the full key only once. If you lose it, create a new one.
When creating it you choose the key type. A personal key acts as you and stops working if you leave the organization. A service account key is meant for workloads such as a server or an automation. Anthropic recommends a personal key for your own development and a service account key for anything shared. If the “Create key” button is greyed out, your role probably does not allow it; an admin can change it or create a service account key for you.
Keep the key safe
Anthropic compares the API key to a credit card number: whoever has it runs up charges on your account. That leads to a few fixed rules Anthropic lists in its help article on API keys:
- Never put it in code or configuration files. The key belongs in an environment variable. The official SDKs read
ANTHROPIC_API_KEY automatically.
- Add a local
.env file to your source control ignore file, so it never lands in the repository.
- Regularly scan your repositories for accidentally committed secrets, for example with Gitleaks or your Git host's secret scanning.
- If in doubt, revoke at once: on the API keys page in the Console, choose “Delete API key” from the menu next to the key.
If a Claude API key shows up in a public GitHub repository, according to Anthropic GitHub notifies Anthropic immediately and Anthropic deactivates the key automatically. I would not rely on that; it is the safety net, not the plan.
In my setup, API keys sit in the repository encrypted with SOPS and are only decrypted into a Git-ignored .env during installation; how that looks on my server is described in Claude Code on a Server: tmux, Remote Control. A secret scan before every push is a rule in my team's rulebook, not an automation. That is more honest than it sounds: a rule can be forgotten.
The first call
Once the key is set as an environment variable, all you need in Python is the official SDK (pip install anthropic) and a few lines, as in Anthropic's quickstart:
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1000,
messages=[{"role": "user", "content": "Summarize this customer email in three sentences: ..."}],
)
print(message.content[0].text)
For TypeScript the package is @anthropic-ai/sdk; other languages are in the quickstart. Besides the text, the response contains the tokens used, so you can work out the cost of each request.
Claude API pricing per model
Prices per million tokens in US dollars according to Anthropic's pricing page, as of October 26, 2026.
A worked example to make the numbers tangible: 1,000 requests with Sonnet 5.5, each with 2,000 input tokens and 500 output tokens, add up to two million input tokens (4 dollars) and half a million output tokens (5 dollars), 9 dollars in total. Through the Batch API it would be 4.50 dollars. This is an example calculation, not a measurement from my own operation.
Two surcharges you should know. If you pin processing to the US with the inference_geo parameter, Anthropic charges 1.1 times the price. And fast mode for Opus 5.5 costs double. If processing in the EU matters to you, the API directly from Anthropic is not the only route; how it works through Amazon is covered in Claude on AWS Bedrock: EU, GDPR and Cost.
Two savings levers: prompt caching and batch
Prompt caching pays off as soon as many requests start with the same beginning: a long instruction, a handbook, examples. Claude keeps that beginning, and each further request reads it from the cache instead of processing it again. By default the cache lasts five minutes and is refreshed for free each time it is used; one hour is available at extra cost. Writing to the cache costs 1.25 times the normal input price (double for one hour), reading only a fraction: 5 percent on Opus 5.5 and Sonnet 5.5, 2.5 percent on Fable 5.1, 10 percent on the other models. According to Anthropic, the five-minute cache pays off after the first read. You can switch it on with a single cache_control field in the request. Very short beginnings are not cached; for the new 5.5 models the documentation puts the minimum at 512 tokens.
The Batch API is for everything that does not have to be ready right away: analyzing a hundred customer emails overnight, reviewing your existing product descriptions. You send the requests together, Anthropic works through them, and you pay half. According to the documentation, most batches finish in under an hour; open requests expire after 24 hours at the latest. A batch can hold up to 100,000 requests or 256 MB. Caching and batch can be combined.
API credits from Max and Team
Since October 7, 2026, Max and Team plans get monthly API credits: 100 dollars on Max 5x, 200 dollars on Max 20x, and on Team 20 dollars per Standard seat and 100 dollars per Premium seat, pooled into one balance capped at 500 dollars a month. According to Anthropic, a team with three Standard and two Premium seats therefore gets 260 dollars, a team with two Standard seats 40 dollars. Free, Pro and Enterprise get no credits.
According to Anthropic's documentation, you claim them like this: on claude.ai under Settings and Billing (on Team in the organization settings), link a Console organization in the “API credits” section. The credits then appear in the Console under “Promotional credits”. You do not need a payment method in the Console for this. Four points that are easy to miss:
- Only after seven days on an eligible plan can you claim the credits.
- The link is fixed. Each plan links exactly one Console organization; changing it only works through support.
- They expire at the end of each billing cycle; unused credits do not roll over.
- They do not cover interactive Claude Code. Covered are the API, Managed Agents, the Agent SDK and the playground in the Console. Not covered are Claude Code sessions in the terminal, IDE, desktop or web, and extra usage beyond your plan limits. Anthropic names one exception:
claude -p and the Agent SDK draw on the credits when you run them with an API key from the linked Console organization.
For you that means: if you pay for Max anyway, you have a small budget to try out your own application or agent without an extra bill.
Claude API and Claude Code: where the line is
You can run Claude Code on a subscription or with an API key. That is handy and a trap at the same time: if the environment variable ANTHROPIC_API_KEY is set, according to the documentation Claude Code uses that key once you have approved it, even if you have a subscription. In non-interactive mode with -p the key is used without asking. You then pay per token instead of drawing on your allowance. /status shows which sign-in is active, and unset ANTHROPIC_API_KEY falls back to your subscription.
My recommendation: keep the two worlds apart. Your own work in Claude Code on the subscription, your own programs on the API with their own key and their own workspace with a spend limit. What the two routes cost for Claude Code is compared in my article “Claude Code Pricing: Plan or API?”. If you want to build an agent on the API rather than send individual requests, the building blocks, from the Agent SDK to Managed Agents, are in Claude Agents: SDK, Managed Agents, Duet.
Frequently asked questions
Is the Claude API free?
No, it bills by usage, per model and token. If you pay for Max or Team, you have been getting monthly API credits since October 2026 and do not need a payment method in the Console for them. Once the credits are used up and nothing has been purchased, requests stop until the next month.
Where do I find my Claude API key?
In the Claude Console at platform.claude.com/settings/keys. You only see the full key once, when it is created. If it is lost, create a new one and revoke the old one.
Do I need the API if I have Claude Pro?
Not for your own work. Pro covers the chat, the apps and Claude Code. You only need the API when a program of your own is supposed to talk to Claude. Pro, by the way, includes no API credits; those come only with Max and Team.
How much does the Claude API cost per month?
That depends entirely on usage. There is no base fee. For a predictable cap, create a separate workspace for your project and set a spend limit there. The worked example above shows the order of magnitude: 1,000 medium-sized requests with Sonnet 5.5 cost about 9 dollars.
Can I use the Max API credits for Claude Code?
Not for normal work. According to Anthropic, the credits explicitly do not cover interactive Claude Code sessions. They apply to the API, Managed Agents, the Agent SDK and the playground in the Console. Only if you run claude -p or the Agent SDK with an API key from the linked Console organization does that count as Agent SDK usage and draw on the credits.
Is the Anthropic API the same as the Claude API?
Yes. Anthropic now calls it the Claude API; according to the documentation the keys are called “Claude API keys”, also known as “Anthropic API keys”.
Where to go from here
If you do not have a use case yet, stay on the subscription and learn Claude Code first, for example with Claude Code: A Guide for Beginners. If you do: create a key, set up a separate workspace with a spend limit, test with Sonnet 5.5 or Haiku 5.5 and note the tokens in the responses before you let it loose on large volumes. External systems are best connected through an MCP server, as described in Set Up a Claude MCP Server. And if you want to talk to others who build their own AI employees, with and without the API: that happens in my German-speaking community Claude Practitioners.