Authentication
How to send your API key, how to choose a group, and the quota, model and IP limits you can set on a key.
Sending your API key
Every endpoint is authenticated with a key that starts with sk-, created in the console. Pass it the way each protocol's SDK normally does — the gateway recognizes all of them:
| Protocol | Header | Example |
|---|---|---|
OpenAI-compatible (/v1/...) |
Authorization |
Authorization: Bearer sk-xxx |
Anthropic native (/v1/messages) |
x-api-key or Authorization |
x-api-key: sk-xxx |
Gemini native (/v1beta/...) |
x-goog-api-key or the key query parameter |
x-goog-api-key: sk-xxx |
Volcengine Ark-compatible (/api/v3/...) |
Authorization |
Authorization: Bearer sk-xxx |
Keep your key on a server or your own machine only. Never put it in web front-end code, mobile app bundles or public repositories. If it leaks, delete it in the console immediately and create a new one.
Choosing a group
When you create a key, you can select one or more groups (routes):
- One group: every request uses that group.
- Several groups: the first group in your order is used first; if it has no available route for the requested model, the request automatically falls through to the next group.
To pin a single request to one of the key's groups, add the X-Token-Group header:
cURL
curl https://api.onefast.ai/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "X-Token-Group: <group-id>" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5.5", "messages": [{"role": "user", "content": "Hi"}]}'
- For group IDs (such as
claude_high), see Groups & billing · Group list. - The group must be in the key's group list, otherwise you get
403. - Once you pin a group explicitly, the request does not fall through to other groups.
Key limits
Each key can be configured individually. Requests that exceed a limit are rejected right away and are not billed:
| Limit | Description | When triggered |
|---|---|---|
| Quota | Total amount the key may spend | 401 this API key has run out of quota |
| Expiry | The key stops working after this time | 401 this API key has expired |
| Model allowlist | Only the listed models can be called | 403 This token has no access to model ... |
| IP allowlist | Only the listed IPs can call (one per line, exact match) | 403 Your IP address is not in the token's allowed IP list |
See Errors for the full list.
Checking your balance
You can query balance and usage directly with your key (OpenAI-compatible format):
cURL
curl https://api.onefast.ai/v1/dashboard/billing/subscription -H "Authorization: Bearer $API_KEY"
hard_limit_usd in the response is the key's total available amount (USD); a key with unlimited quota shows a very large number. For per-request details, open the "Logs" page in the console.