OneProvider
CLAUDE API · API KEY

Claude API key: how to get one and use it

A Claude API key lets your code, Claude Code or any compatible tool call Claude models and pay per token. This guide shows how to create one in the Claude Console, how limits and spend caps work, and a second route through a gateway key. Anthropic API key and Claude API key mean the same thing.

What an API key is, and what it is not

An API key is a secret string that your code sends with every request. Usage is billed per token to the organization that owns the key. A claude.ai subscription is a different thing: it signs you in to the apps with a monthly plan.

Subscription and API key side by side
SubscriptionAPI key
How you use itSign in to Claude apps and Claude CodeSend the key from your code or tool
BillingMonthly plan with usage limitsPer token, on your organization account
Where it comes fromclaude.comClaude Console
Typical useChat, daily work in the appsApps, scripts, CI, tools that ask for a key

Create a key in the Claude Console

  1. Open or create a Console account

    Go to platform.claude.com and sign up, or sign in to the account you have.

  2. Set up billing

    API usage is paid per token, so set up billing in the Console before you expect requests to go through.

  3. Create the key

    Open Settings, then API Keys, and click Create Key. Copy it at once, because it is shown only one time.

  4. Export it and send a first request

    Keep the key in an environment variable, never in code. Then call the Messages API.

    export ANTHROPIC_API_KEY=sk-...
    
    curl https://api.anthropic.com/v1/messages \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "content-type: application/json" \
      -d '{"model": "claude-sonnet-5-5", "max_tokens": 256, "messages": [{"role": "user", "content": "Say hi in one sentence"}]}'

Limits and spend caps

Limits belong to the organization, not to a single key. Anthropic places organizations in a usage tier automatically, and a new organization with little history may start in an Evaluation tier with limits below the standard ones. They rise as you build usage history.

Monthly spend cap by tier, from Anthropic's rate limits page
TierMonthly spend cap
Start$500
Build$1,000
Scale$200,000

You can set your own spend limit below the cap in the Console under Spend limits. When the cap is reached, API usage pauses until 00:00 UTC on the first day of the next month, and requests return HTTP 429.

Keep the key safe

  • Never commit a key to a repository, and never paste it into a ticket, a screenshot or a chat.
  • Use one key per project or machine, so you can revoke one without breaking the rest.
  • Set a spend limit before you give a key to a script that runs unattended.
  • If a key leaks, delete it in the Console and create a new one. Do not wait to see whether it is used.

Another route: a OneProvider key

If you want to pay from a prepaid USD balance, or you want several keys with their own limits under one balance, a gateway key does the same job. OneProvider accepts the Anthropic Messages format directly, so the request above only changes its address and key.

curl https://api.oneprovider.dev/v1/messages \
  -H "x-api-key: $ONEPROVIDER_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-5-5", "max_tokens": 256, "messages": [{"role": "user", "content": "Say hi in one sentence"}]}'
  • Top up at app.oneprovider.dev or in the Telegram bot @oneprovider_robot by crypto or card. Fees are shown before you pay.
  • Three keys are available by default. Each has a name, an optional spend limit and a term of up to 90 days.
  • The balance does not expire and there is no subscription.

Frequently asked questions

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

Yes. Both names mean a key from the Claude Console that authorizes API requests and is billed per token.

Is the Claude API key free?

Creating a key costs nothing, but requests are billed per token. Check the Console for any credit that your account holds.

Does Claude Pro include an API key?

Pro does not list API credits. Max and Ultra list monthly API credits for the Claude Platform ($100 and $200 on claude.com/pricing). Read the plan terms before you rely on them.

Can I use an API key in Claude Code?

Yes. Set ANTHROPIC_API_KEY, start claude and approve the key when it asks. Requests are billed per token and the plan limits do not apply.

How do I limit what a key can spend?

In the Console, set a monthly spend limit under Spend limits. With a OneProvider key, set the limit on each key in the cabinet.

What should I do if my key leaks?

Delete it in the Console and create a new one right away, then update the places that used it.

Claude, ChatGPT, GPT, Cursor and other product names are trademarks of their owners and are used only to describe compatibility. We do not give legal advice: following local rules stays with the user.