Docs
Authentication
Updated 2026-07-21
API Key
All protected model requests must include a Bearer token in the Authorization header:
Authorization: Bearer sk-xxxxxxxx
The official OpenAI SDK only requires configuring api_key / apiKey, and the SDK automatically sets this header.
Security recommendations
- Do not store keys in public frontend code or public repositories
- Use separate keys for development and production environments
- Rotate or delete keys in the console immediately if a leak is detected
Common errors
| Status code | Meaning | Recommended action |
|---|---|---|
| 401 | Unauthorized | Verify that the key is correct and not disabled |
| 403 | Forbidden | Check account permissions, model group, or balance |
| 429 | Rate limit exceeded | Reduce concurrency or retry later |
See Error codes and Rate limits.