API
Errors
Provider-compatible model API errors and practical retry guidance.
Model endpoints return the error shape associated with the request family. OpenAI-compatible routes return an OpenAI-style envelope. The Anthropic-compatible Messages route returns an Anthropic-style envelope. Streaming failures may arrive as events after the HTTP response has started.
OpenAI-compatible error
{
"error": {
"type": "authentication_error",
"message": "Authentication failed"
}
}
Anthropic-compatible error
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "Authentication failed"
}
}
Status codes
| Status | Meaning | Client action |
|---|---|---|
400 | Invalid request or unsupported model | Correct the request; refresh /v1/models if the model is unknown |
401 | Missing or invalid credential | Replace or refresh the credential |
402 | Account is out of model-API credits | Add credits, then retry |
429 | Key, account, or provider limit | Honor Retry-After when present and back off |
502 | Upstream model request failed | Retry cautiously if the operation is safe |
529 | Model temporarily overloaded | Retry with bounded backoff |
Do not depend on the exact wording of message. Branch on HTTP status and, when present, the structured error type.
For streaming calls, handle both a non-2xx response before the stream starts and an in-band error event after it starts. See limits and retries.