Skip to content

Tokens and groups

A token (API key) is the credential you send with each request. It is a string that starts with sk-. You can create several tokens, each with its own settings. Using a separate token for each device or project means that if one leaks, you only need to delete that one.

Manage tokens on the API Keys page in the console (/keys).

Setting What it does
Name For your reference only. You can change it at any time.
Quota The most this token can spend. Set it to “unlimited” and the token is limited only by your account balance. When a token’s quota runs out, the token stops working, but your account balance is unaffected.
Expiry The token stops working after this time. It can also be set to never expire.
Model limits When enabled, the token can only call the models you select. Calls to any other model return 403.
IP allowlist Only the listed IP addresses or CIDR ranges can use the token. Useful on servers with a fixed outbound IP.
Group Decides which set of channels the token uses and which multiplier applies. See below.

A token that has expired, used up its quota or been disabled returns 401 Invalid token.

A group decides two things:

  1. Which models are available. Each group is backed by different upstream channels, so the available models differ.
  2. The price multiplier. The same model can carry a different multiplier in different groups. The amount charged is the base price times the group multiplier.

The pricing page shows the models and multiplier for each group, and lets you filter by group.

Some groups need a particular subscription plan: while such a plan is active it upgrades your account group, which is what lets you choose those groups for a token. Your group goes back when the plan ends.

A token in the auto group looks through several groups in order until it finds one with a channel that serves the requested model, so you do not need to know which group a model belongs to. If you want a model to always go through a specific group, create a separate token for it and set that group.

The “cross-group retry” token setting only applies to the auto group. When it is on and a request fails on the current group’s channel, the gateway tries the next group. That group may have a different multiplier, so check the Usage Logs page for the amount actually charged.

  • Never put a token in front-end code, a mobile app or a public repository.
  • On servers, turn on the IP allowlist where you can.
  • Give each token a sensible spending limit so a leaked token cannot spend much.
  • If you think a token has leaked, delete it in the console and create a new one.