Authentication
All API requests require authentication via an API key passed in the Authorization header.
API Key Format
text
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxx
Creating API Keys
- Go to the API Keys page in the portal
- Click Create New Key
- Optionally specify scopes to restrict the key's access
- Copy the key immediately — it won't be displayed again
Scopes
API keys can be scoped to limit access:
| Scope | Description |
|---|---|
chat | Access to chat completion endpoints |
embeddings | Access to embedding endpoints |
metrics:read | Access to usage metrics |
If no scopes are specified, the key has access to all endpoints.
Security Best Practices
- Never expose keys in client-side code. Use a backend proxy.
- Rotate keys regularly. Delete old keys and create new ones.
- Use scoped keys when possible to limit blast radius.
- Monitor usage in the dashboard to detect anomalies.
Error Responses
| Status | Meaning |
|---|---|
401 Unauthorized | Missing or invalid API key |
403 Forbidden | Key doesn't have the required scope |