OpenAI-compatible protocol
Claude Messages protocol
SDKs usually add
anthropic-version automatically, so you don’t need to set it manually when using an SDK.Gemini native protocol
?key=sk-...), but this is not recommended — the URL gets logged by proxies.
Failure examples
| Status | Cause |
|---|---|
401 invalid_api_key | Key doesn’t exist / disabled / wrong format / trailing newline |
401 expired_api_key | The token has expired |
403 insufficient_quota | Account or token quota insufficient |
403 ip_not_allowed | The source IP isn’t in the token’s allowlist |
403 model_not_allowed | The token lacks permission to call this model |
- Copy the
X-OpenPAI-Request-Idheader. - Console → Logs → search for that Request ID to see the detailed failure reason.
Key safekeeping
- Do not commit keys to Git or paste them into chats / issues.
- Inject them via environment variables / a secret manager.
- If you suspect a leak, disable and regenerate immediately in the console.
- Create separate tokens per app / environment for fine-grained tracking.