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 codeMeaningRecommended action
401UnauthorizedVerify that the key is correct and not disabled
403ForbiddenCheck account permissions, model group, or balance
429Rate limit exceededReduce concurrency or retry later

See Error codes and Rate limits.