Authentication
Bearer token authentication, key scopes, and rate limits.
Authentication
Every request needs your API key as a Bearer token:
Authorization: Bearer fm_your_key_here
Requests without a valid key return 401:
{
"error": {
"message": "Missing or invalid API key.",
"type": "authentication_error",
"code": "invalid_api_key"
}
}
Treat a key like a password. If one leaks, revoke it on the Keys page and create a new one — a revoked key stops working at once.
Key scopes
Each key carries a set of scopes. A request outside a key's scopes returns 403 with code insufficient_scope.
| Scope | Grants access to |
|---|---|
inference |
POST /chat/completions |
models:read |
GET /models, GET /models/{id} |
embeddings |
POST /embeddings — reserved — endpoint not available yet (501) |
New keys receive all three scopes by default. Most coding agents call /models before their first completion, so keep models:read enabled unless you have a specific reason to narrow the key.
Rate limits
Each plan has a requests-per-minute limit for the whole account, and a key can have its own lower limit (see Rate limits). Your token allowance is separate: when it is used up, requests answer HTTP 402 until you add tokens.
Every response reports your current state:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 297
X-RateLimit-Reset: 1787305980
X-RateLimit-Limit-Tokens: 100000000
X-RateLimit-Remaining-Tokens: 99498412
The -Tokens headers show your plan's token allowance and what is left of it; there is no tokens-per-minute limit.
Exceeding a limit returns 429 with a Retry-After header giving the seconds until the window resets:
{
"error": {
"message": "Rate limit exceeded: 300 requests per minute.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
Your current limits and live usage are shown under Dashboard → Usage → Rate Limits.
Error format
All errors use the same envelope, matching OpenAI's shape:
{
"error": {
"message": "Human-readable description",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}
| Status | type |
Meaning |
|---|---|---|
401 |
authentication_error |
Missing, malformed, or revoked key |
402 |
insufficient_funds |
Out of balance and plan allowance |
403 |
invalid_request_error |
Key lacks the required scope |
404 |
invalid_request_error |
Unknown model or endpoint |
422 |
invalid_request_error |
Request body failed validation |
429 |
rate_limit_error |
Rate limit exceeded |
502 |
provider_error |
Upstream model provider failed |