---
title: "How to Get a Claude API Key: 6-Step Console Setup and Spend Limits"
description: "A Claude API key is created in the Anthropic Console: sign up, add credit, create the key, set spend limits. Covers supported regions and RMB alternatives."
url: https://cdnping.org/en/blog/how-to-get-claude-api-key
language: en
published: 2026-11-23
category: "AI concepts"
tags: ["Claude","Anthropic","API key","Console","Getting started"]
source: cdnping.org
license: Free to quote and summarize with a link to the url above.
---
# How to Get a Claude API Key: 6-Step Console Setup and Spend Limits

A Claude API key can only be created in Anthropic's developer platform (the Anthropic Console). You need an account in a region Anthropic officially supports, and the account needs paid credit. The flow is: sign up, verify, add credit, create a key, set a spend limit. The steps below follow that order. Exact pages and fields change as Anthropic updates the product, so treat the Console and the official docs as the source of truth.

If you want to know what comes after getting a key, such as sending your first request, see [How to use the Claude API: from getting a key to your first request](/en/blog/claude-api-beginner-getting-started).

## First, an API key and a Claude web subscription are different things

A subscription to the Claude web app or mobile app and an API account in the Console are billed separately. A subscription is charged monthly. The API is billed by actual usage (input and output tokens). A subscription does not come with API credit, and the reverse is also true. For the differences, see [Claude API vs. web subscription: which one should you buy](/en/blog/claude-api-vs-subscription-difference).

So "getting an API key" is not a button in the web app. You set it up separately in the Console.

## Can you sign up? Check the supported regions first

Anthropic publishes a list of countries and regions where the service is available, and requires users to follow its terms of service and usage policy. Mainland China is currently not on the officially supported list. The authoritative list is Anthropic's "Supported countries and regions" page. It changes, so check the official page on the day you sign up.

This has a few implications:

- Your region needs to be supported before you can sign up and pay through the normal process.
- The information you provide at signup must be accurate, and your payment method must match the account's location.
- Do not use someone else's account, shared keys, or an unverified "we'll set it up for you" service. These violate the terms, and if the account is disabled, your own business takes the loss. For what happens when an organization is disabled, see [Anthropic API organization disabled: causes, impact, and what to do](/en/blog/anthropic-api-organization-disabled).

If your region is not supported, a later section covers other options.

## The official Console flow in 6 steps

This is the general flow. Interface wording follows the official product.

1. **Sign up or log in to the Console.** Create an account with an email address or another officially supported sign-in method, and complete email verification. Whether extra verification such as a phone number is required depends on the prompts you see at signup.
2. **Create or confirm an organization.** API usage, members, and billing all belong to an organization. For personal use, the default organization is enough. For multiple users, see [Anthropic Console member roles: how to give teammates access](/en/blog/anthropic-console-member-roles).
3. **Add credit or a payment method.** The API usually requires available credit before you can make calls. Supported payment methods, the minimum top-up amount, and whether auto-reload is available are shown on the Console billing page, so this article does not list specific amounts.
4. **Create an API key.** On the API Keys page in the Console, create a new key and give it a name that shows its purpose, for example `blog-bot-dev`.
5. **Save the key immediately.** The full key is usually shown only once, at creation. Store it in a password manager or an environment variable. Do not paste it into chat windows, screenshots, or public repositories.
6. **Set a spend limit and turn on alerts.** See the next section.

## How do you set a spend limit so the bill doesn't get out of control?

The most common beginner mistake is a leaked key or an infinite loop in code that burns through a lot of credit in a few hours. When you get your key, do these things too:

- In the Console's usage and limits settings, check and set a monthly spend limit for the organization or workspace. Which dimensions you can limit and how limits take effect are covered in the official docs.
- Use one key per project instead of sharing one across all tools. If one key leaks, deleting it does not affect other projects.
- Check the usage records in the Console regularly, and rotate the key as soon as you see call volume you don't recognize.
- Disable keys you no longer use.

## After you get the key, how do you check that it works?

Put the key in an environment variable instead of writing it into code:

```bash
export ANTHROPIC_API_KEY="your key"
```

Then send a minimal request with curl. The version header, model name, and fields follow Anthropic's official API docs; placeholders are used here for the model name:

```bash
curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: <see the official docs>" \
  -H "content-type: application/json" \
  -d '{"model": "<model name from the official docs>", "max_tokens": 64,
       "messages": [{"role": "user", "content": "Hello"}]}'
```

Common failures and how to diagnose them:

| Symptom | Likely cause | How to check |
|---|---|---|
| 401 | Key copied wrong, deleted, or the environment variable didn't take effect | Copy it again; run `echo` to see whether the variable is empty |
| 403 | Permission, region, or account status issue | Check the official error-code docs and the supported regions; contact official support if needed |
| 429 | Rate limit hit or insufficient credit | Check the limits and balance in the Console |
| Connection timeout | Network path problem | Check [Anthropic API status](/en/status/anthropic) first, then your local network |

If the error looks network-related, see [AI API latency and reachability from China](/en/learn/ai-api-latency-china) to learn how to tell a server-side problem from a path problem. To see whether Claude as a whole is having issues, you can also look at [Is Claude down?](/en/down/claude).

## What extra do you need if Claude Code should use an API key?

Claude Code can sign in with a subscription or use an API key. The two are billed differently, and switching between them can trigger an authentication conflict. For the trade-offs, see [Claude Code: subscription login or API key, and how the two billing models compare](/en/blog/claude-code-subscription-or-api-key).

## What if your region isn't supported, or you have no overseas payment method?

To be clear first: do not use someone else's account, a resold key, or any way of getting around the region check. The official terms do not allow it, and the risk is yours.

There are two legitimate kinds of paths to consider:

- **The official path.** If you actually live in, or your company is registered in, a supported region, sign up in the Console with real information and a real payment method. This is the most stable option.
- **Third-party aggregation gateways.** Some services bill in RMB and offer endpoints compatible with the OpenAI and Anthropic formats. Before using one, confirm whether it claims to be an officially authorized channel, and how it handles your data.

AGI Plan falls in the second category. AGI Plan is a commercial partner of cdnping. It is a multi-provider LLM aggregation gateway with monthly subscriptions, payment in RMB, and no overseas credit card required, and one subscription can switch between multiple capability groups. Tools such as Claude Code and Codex only need one endpoint address changed, and the Claude Code setup does not need a Claude account. Note that the service says explicitly that it is not an officially authorized channel, and some models are marked "overseas only". Check the [AGI Plan models page](https://agiplan.dev/models) for specifics. For how to connect, see [AGI Plan getting started](https://agiplan.dev/startup).

## What to do next

- If you can use the official path: follow the 6 steps above, set the monthly limit low first, get a test key working with curl, and then connect your tools.
- If you can't use the official path for now: read [How to start using Claude: web app, official API, and third-party gateway](/en/blog/claude-for-beginners-ways-to-use) first, compare the options, and don't rush to pay.
- Whichever path you take, read [Anthropic's usage policy explained](/en/blog/anthropic-usage-policy-explained) to learn which uses are prohibited.

The page names, supported regions, and payment rules mentioned here follow Anthropic's official documentation. This article was written in October 2026.
