Tokens and groups
What a token is
Section titled “What a token is”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 Tokens page in the console (/console/token).
Token settings
Section titled “Token settings”| 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.
Groups and multipliers
Section titled “Groups and multipliers”A group decides two things:
- Which models are available. Each group is backed by different upstream channels, so the available models differ.
- 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.
The auto group
Section titled “The auto group”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.
Cross-group retry
Section titled “Cross-group retry”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 Logs page for the amount actually charged.
Security tips
Section titled “Security tips”- 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.