APIs and setup
API key
An API key is a secret string a program sends with each request to prove which account is calling. The API uses it to authorize the request and to bill that account for it.
Also called Secret key, API token, Bearer token
Checked November 29, 2026
At a glance
- Sent in
Authorization: Bearer, orx-api-keyon Anthropic's API- Identifies
- The account that is calling, and paying
- Kept in
- An environment variable or a secrets manager
- If it leaks
- Revoke it and make a new one
- On /model
sk-sm-…, each with its own caps, IP list, models and expiry
Most AI APIs take the key in an Authorization: Bearer header. Anthropic's API takes it there too, or in its older x-api-key header (Anthropic). The SDKs read it from an environment variable or a setting, so it stays out of your code.
Keeping a key safe
- Treat it like a password: anyone who has the key can spend the account's balance.
- Keep it in an environment variable or a secrets manager, never in code you commit or in a web page.
- Use a separate key for each app, so one can be revoked without stopping the others.
- If a key leaks, revoke it and make a new one.
API keys on /model
- Keys look like
sk-sm-…. Send yours inAuthorization: Bearerorx-api-key; every request needs one, except the model list and the price list (Authentication). - A key is shown only once, when you create it on the API keys page, so store it somewhere safe (Quick start).
- Each key has its own settings: routing, a daily and a monthly spending cap in USD, maximum prices, up to 50 allowed IP addresses or ranges, the models it may use, and an expiry date. A key can be disabled, or revoked for good (Key settings).
- A missing or wrong key, or one that is disabled, revoked or expired, gets a 401
invalid_api_key(Errors).
Looking for a key for Claude itself? How to get a Claude API key covers both ways.
Where it applies on /model
Questions
Can I limit what a /model key spends?
Yes. A key can have a daily and a monthly cap in USD, and maximum prices per 1M tokens. At its cap, requests get a 402 key_limit_reached until the cap resets.
Does one key work with both the OpenAI and the Anthropic SDKs?
On /model, yes: one key works on every endpoint, in Authorization: Bearer or x-api-key.
I lost my key. Can I see it again?
No: a key is shown only once. Create a new one, and revoke the old one.
Sources
The makers' own pages, each opened on November 29, 2026.