Getting started / API keys

Getting started

API keys

Create API keys in the console, choose a group, set a spend limit, expiry and model limits, and keep keys safe.

Updated

Every endpoint authenticates with an API key (starting with sk-). You create and manage keys on the API Keys page of the console. One account can have many keys, for different projects or groups.

Creating a key

Click Create API Key on the API Keys page. You can set:

Setting Description
Name For your own reference; shown in the usage logs
Group Required. Decides which models the key can call; see below
Quota The most this key can spend. You can also choose Unlimited Quota, so only your account balance applies
Expiry The key stops working after this time. You can choose Never expires
Model Limits When enabled, the key can only call the models on the list
Allow querying user quota When enabled, usage queries made with this key also return your account balance; see Balance and usage

You can change these settings at any time, and disable or delete the key.

Groups

Each key belongs to one group and can only call the models in that group. The Group column in Models and pricing shows which group each model is in; the prices in that table already reflect the group.

If you need models from different groups (for example Claude models and DeepSeek models), create one key per group.

Calling a model outside the key's group returns 403 This token has no access to model xxx.

Key quota vs. account balance

These are two different things:

  • Account balance: the money you have topped up, shared by every key on the account.
  • Key quota: a spending cap on a single key, so you can limit how much one project can spend.

A request needs both. If the key quota is used up, or the key has expired or been disabled, you get 401 Invalid token. If the account balance is too low, you get 403. See Error codes.

Model limits

With Model Limits enabled and a list of models selected, the key can only call those models; any other model returns 403 This token has no access to model xxx. This is useful when handing a key to a program or a colleague that only needs specific models.

Keeping keys safe

  • The full key is shown only when you choose to reveal it in the console.
  • Keep keys in server-side environment variables or a secrets manager. Never put them in front-end code or app bundles, and never commit them to a public repository.
  • Any request made with your key is treated as your own, and you are responsible for its charges and for any policy violations.
  • If you suspect a key has leaked, disable or delete it in the console right away and create a new one.