Claude API Key: How to Get One, Step by Step

In brief

Get a Claude API key at platform.claude.com/settings/keys: sign in to the Claude Console, buy prepaid credits, click Create key, and copy the sk-ant- key, which is shown once. Claude Pro includes no API credits, while Max includes $100 a month and Ultra $200, as of November 2026.

How do you get a Claude API key?

You create the key yourself on one page of the Claude Console, after you have credits in the account. If you want a guide tuned to your setup, paste this into Claude, ChatGPT, Gemini or Whizi and fill the brackets.

A terracotta Claude starburst on a black plinth, with a small brass key resting against it and a closed leather ledger beside it, in a charcoal studio under white rim light.

I use [Windows, macOS or Linux] and write [Python, JavaScript or another language]. Walk me through making my first Claude API request: where I store the key, how I set ANTHROPIC_API_KEY in my shell, and a ten line script that sends one message. Tell me what each error code would mean if the call fails.

Here are the steps, from Anthropic's Get your Claude API key page, read 22 November 2026. The older address, console.anthropic.com, still answers with a redirect.

  1. Sign in at platform.claude.com, or create an account.
  2. Add credits on the Billing page: click Buy credits, enter an amount and confirm. Anthropic's payment help article says you need the Admin or Billing role, and purchased credits are available immediately.
  3. Open the API keys page at platform.claude.com/settings/keys and click Create key.
  4. Name the key, choose an expiration (3 hours, 1 day, 7 days, 30 days, a custom length or Never) and set Linked account to yourself or a service account.
  5. Copy the key, which starts with sk-ant-. The Console shows it once.
  6. Set it as ANTHROPIC_API_KEY. The official SDKs read that variable on their own.

Direct HTTP requests send the key as an Authorization header with the word Bearer in front of it, and Anthropic still accepts the older x-api-key header. If you use an SDK, you don't write either header, because the client library picks the key up from ANTHROPIC_API_KEY. A key that isn't scoped to a workspace also needs the anthropic-workspace-id header on every request, and a missing header returns a 400.

Anthropic also calls these Anthropic API keys, so the two searches lead to the same page. If the Create key button is grey, your role does not allow it, and an organization admin has to change the role or create a service account key for your workload.

Does Claude Pro or Max include an API key?

No plan includes a key by itself, and Pro includes no API credits at all. Max, Ultra and Team include monthly credits that you claim by linking a Console organization, and you still create the key in the Console. The figures below come from Anthropic's API credits page, read 22 November 2026.

PlanMonthly API creditCatch
FreeNoneNot eligible
ProNoneNot eligible
Max$100Claim after 7 days on the plan
Ultra$200Claim after 7 days on the plan
Team, Standard seat$20 per seatPooled, capped at $500
Team, Premium seat$100 per seatPooled, capped at $500

The credits cover the Claude API, Managed Agents, the Agent SDK and the Console playground. They do not cover Claude Code or extra usage in the Claude apps, and they expire at the end of each billing cycle with no rollover. Each plan links to one Console organization, and you cannot change the link yourself. For the money side of this choice, Claude API vs subscription works out how many messages a day make each route cheaper.

Which ways into Claude need a key, and which do not?

Only calling Claude from your own code needs a key. Chatting needs an account and nothing else. The table lists the routes the top Google results point at, plus Whizi, with what each one states on its own page.

RouteNeeds an API keyWhat it costsCatch
Claude Console keyYesPrepaid credits, no refundsCredits expire after one year
Max, Ultra or Team creditsYes, made in the ConsoleIncluded, $100 to $500 a monthClaude Code not covered
Claude Pro or Free chatNoPlan price or freeNo API credits
Unofficial GitHub package (KoushikNavuluri/Claude-API)No, it uses your browser cookieNot statedSays it is unofficial and use is at your own risk
Free key reels on InstagramOther providers, not ClaudeNot statedNot an Anthropic key, and the page itself says usage on Anthropic is paid
WhiziNo10 messages a day free, Pro $29.99 a monthNo key to call from your own code

Whizi loses where you need code to call Claude. Whizi has no developer API and doesn't issue keys, and only the Console gives you one. The GitHub package describes itself as "not affiliated with or endorsed by Claude AI or Anthropic", and it works by reusing a login cookie from your browser, which is a credential for your whole account. The Instagram page for this query is mostly reels about free keys from other providers, and one caption says a Google AI Studio key will not work in Claude Code.

How do you store a Claude API key safely?

Keep the key in a secrets manager or an environment variable on a server you control, and send requests from your own back end. Anthropic's authentication docs say: "Store API keys in a secrets manager, rotate them periodically, and disable or delete any key you suspect has leaked."

Four settings do most of the work:

  1. Pick the key type. A personal key acts as you and stops working when you leave the organization. A service account key suits CI and production services. A workspace key is a legacy type without an owner.
  2. Set an expiration. Presets run from 3 hours to 30 days, and the setting cannot be changed after creation. An expired key returns a 401.
  3. Scope the key to one workspace. A key scoped to a workspace works only there. An unscoped key must send an anthropic-workspace-id header on every request.
  4. Use Disable before Delete. Disable can be reversed with Re-enable, and Delete is permanent.

You can also skip long lived keys. Anthropic's authentication page lists Workload Identity Federation for production workloads on AWS, Google Cloud, Azure, CI pipelines and Kubernetes. The workload swaps a short lived token from your identity provider for a Claude API access token, so there is no sk-ant- string to mint or rotate. For iOS and macOS apps, App Attest issues tokens that expire after 1 hour.

Never put a key in browser code. A page that calls the API directly exposes the key to anyone who opens it, and organizations with zero data retention get a 401 for browser calls even when the key is valid. If you can't avoid a long lived key, turn on IP allowlisting, which Anthropic describes as a way to limit where a leaked key works.

A leaked key is the expensive failure. Disable it first, because Disable can be undone and a spend spike can't. Then create the replacement, deploy it, confirm requests succeed and delete the old key.

What are Claude API usage tiers and rate limits?

Your organization sits on a usage tier that sets a monthly spend cap and per minute limits. New or low history organizations may start in an Evaluation tier below the figures here. The numbers are for Claude Sonnet 5.5, from Anthropic's rate limits page, read 22 November 2026.

TierMonthly spend capRequests a minuteInput tokens a minuteOutput tokens a minute
Start$5004,0002,000,000400,000
Build$1,00010,0005,000,0001,000,000
Scale$200,00013,00010,000,0002,000,000

Tiers are assigned automatically. Anthropic's tier help article says no deposit or purchase moves you up, and you can ask for higher limits once you use at least 50% of your current ones. Cached input tokens do not count toward the input limit, so caching raises your real throughput. Prices per token are on Claude API pricing.

Workspaces let you split limits. Every organization has a Default Workspace that can't be renamed, archived or deleted, up to 1,000 more can exist by default, and a workspace limit protects the other projects from one runaway script. A workspace with no limit of its own inherits the organization's, and the organization's limits always apply.

You can watch the effect on the Usage page of the Console, which charts uncached input tokens a minute, your cache rate and output tokens against your limit. If the chart sits near the line at peak hours, ask for a higher tier before a launch, not during one.

Why is my Claude API key not working?

Most failures map to one status code, and the code names the cause. The codes below come from Anthropic's errors page, read 22 November 2026.

CodeTypeUsual causeFix
400invalid_request_errorBad request, or a spend limit you set was reachedRead the message, raise or remove your limit
401authentication_errorKey malformed, revoked or expiredCreate a new key
402billing_errorBilling or payment problemCheck payment details in the Console
403permission_errorKey lacks access to that resourceCheck organization and workspace settings
404not_found_errorWrong endpoint, or a workspace the key cannot seeCheck the path and the workspace ID
409conflict_errorRequest clashes with the current state of a resourceResolve the conflict, then retry
413request_too_largeRequest over the size limitSend less, for example under 128 MB on Messages
429rate_limit_errorRate limit, ramp limit or monthly spend capWait the retry-after seconds if sent
500api_errorFault inside AnthropicRetry with backoff
504timeout_errorRequest timed out while processingUse streaming for long requests
529overloaded_errorHigh traffic across all usersRetry later

Two cases trip up new keys. When credits run out the API says "Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits." And a spend cap 429 has no retry-after header, so retrying fails until the first of next month. The official SDK retries transient errors twice by default. For the chat version of a 429, see Claude too many requests.

What does a good answer look like for three key problems?

Each example gives the prompt and what a correct reply must contain. They are written for this page, not the output of a named model.

  1. A 401 on the first call. Prompt: "My Claude API call returns 401 authentication_error. I created the key an hour ago with a 3 hour expiration, and I set ANTHROPIC_API_KEY in one terminal tab. List the causes in order of likelihood." A good answer lists an expired key, a variable not set in the shell that runs the script, a pasted key with a trailing space, and a revoked key, and says to create a new key if it expired.
  1. A bill that worries you. Prompt: "I will use Claude from a script for [use case]. Tell me how to cap my spend: a limit at org level, a workspace for this project and a key scoped to it." A good answer names the Spend limits page, a workspace spend limit and a workspace scoped key, and notes that a limit you set returns a 400 when reached.
  1. A key pasted into a public repository. Prompt: "I committed an Anthropic key to GitHub. What do I do, in order?" A good answer says to disable or delete the key in the Console first, create a replacement, move it to a secrets manager and check usage. Removing the commit is not enough, because the key stays in history.

Which prompts help you set up and debug a Claude key?

These ten work in Claude, ChatGPT, Gemini or Whizi. Fill the brackets and never paste a real key into any chat.

Setup

  1. "Write the shell commands to set ANTHROPIC_API_KEY for [PowerShell, bash or zsh] so it survives a restart."
  2. "Give me a [Python or TypeScript] script that reads ANTHROPIC_API_KEY, sends one message and prints the reply and the request ID."
  3. "Compare a personal key, a service account key and a workspace key for [my situation] in a three row table."

Safety

  1. "Review this .gitignore and config for places an API key could leak: [paste]. Never ask me for the key itself."
  2. "Draft a rotation checklist for a key used by [number] services, with the order of steps."
  3. "Explain why my web page must call my server and not the Claude API directly, in three sentences for a [beginner or manager]."

Cost and limits

  1. "I send about [number] requests a day of [number] tokens each. Which usage tier limits could I hit and in what order?"
  2. "Write a retry loop for 429 and 529 errors with exponential backoff that respects a retry-after header."
  3. "Turn this error JSON into a plain English fix: [paste, key removed]."
  4. "Make a one page cost plan for [project]: model choice, caching, a Batch job for anything not urgent and a monthly cap."

What mistakes ruin a Claude API key setup?

  1. Losing the key at creation. The Console shows it once. The fix is to copy it straight into a secrets manager, and to create a new key if you miss it.
  2. Shipping the key in browser code. The fix is a small back end that holds the key and calls Claude for the page.
  3. Using a personal key for a shared service. It stops working when that person leaves. The fix is a service account key.
  4. Expecting Pro to cover the API. Pro has no API credits. The fix is to buy credits, or to be on Max, Ultra or Team and link an organization.
  5. Retrying a spend cap error. It has no retry-after header and keeps failing until access resumes. The fix is to raise the cap by requesting a higher limit or wait for the new month.

Where does Whizi fit if you do not need a key?

Whizi is one app instead of a console, a credit balance and a usage tier, and it suits you if you want to use Claude rather than build with it. You'll sign in, pick a model and chat.

The free plan gives you 10 messages a day on Whizi AI, Auto and Claude Haiku, with no card. Pro carries Claude, GPT and Gemini in one app, and its first week is $1.99. Side by side Compare puts one prompt to two models, and it is on Pro and Powerhouse. Web search is on by default in each chat, and you can attach a PDF, Word or Excel file for the model to read.

Excel and Word files made in chat have no plan gate, so a reply can come back as a spreadsheet or a document. You manage a plan, not a key. If code has to call Claude, you still need the Console, because Whizi issues no keys.

What can a Claude API key not do?

A key does not make Claude cheaper, safer or unlimited. It is a credential, and anyone holding it spends your credits. Anthropic states that credits you buy are non-refundable and expire one year after purchase, so buy what you will use.

The key also doesn't unlock the consumer plans. API credits are separate from Claude Pro, and Claude Code is not covered by the monthly credits for Max, Ultra or Team. Limits, tiers and model names move, so check the Console's Rate limits page before you plan around a number from any article, including this one. It's the one place that shows your own tier.

Workflow checklist
  • Create the key on platform.claude.com/settings/keys and copy it at once
  • Store it in a secrets manager or ANTHROPIC_API_KEY, never in browser code
  • Scope the key to one workspace and pick an expiration
  • Set a monthly spend limit before the first real job
  • Send one small test message and read the status code on any failure
Common questions

Frequently asked questions

Is the Claude API key free?

No. A key itself costs nothing to create, but calls are paid from prepaid credits, and Anthropic's help article says that with no credits you cannot call the API. Max, Ultra and Team plans include monthly API credits, as of November 2026. See Claude API pricing for per token rates.

How do I find my Claude API key if I lost it?

You cannot. The Console shows the full key only once, and the Admin API never returns the secret. Open the API keys page, create a new key, update wherever the old one was used, then delete the old key.

Is an Anthropic API key the same as a Claude API key?

Yes. Anthropic's docs say API keys for the Claude API are also called Anthropic API keys, and both live on the Console API keys page. They start with sk-ant- and are separate from your claude.ai chat login.

How much will my first Claude API calls cost?

A short test message costs a fraction of a cent on small models, but check before you scale. The token counter shows the token count for Claude, ChatGPT and Gemini models plus an estimated API price, so you can price a prompt before you send it.