Skip to content

Errors

The API uses conventional HTTP status codes. Error responses are JSON with an error object containing a human-readable message:

{
"error": {
"message": "Invalid API key"
}
}
StatusWhen it happensWhat to do
400 Bad RequestMalformed JSON, or the model field is missing.Fix the request body.
401 UnauthorizedMissing, invalid, or revoked API key.Check the key and the Authorization header.
404 Not FoundUnknown model, or no serving endpoint for it ("no endpoint for model ...").Pick a model from GET /v1/models.
429 Too Many RequestsAn org or per-key rate limit was exceeded.Back off and retry; consider raising per-key limits or contacting support for a higher org tier.
502 Bad GatewayAll upstream endpoints for the model failed after retries ("all endpoints exhausted").Retry with backoff; if persistent, try another model or contact support.
503 Service UnavailableAuthentication or model routing temporarily unavailable.Retry with backoff — this is transient and not caused by your request.
4xx/5xx (other)Errors from the underlying model provider are passed through with their original status and body.Handle per the provider’s error semantics.
  • Retry 429, 502, and 503 with exponential backoff and jitter. Rate-limit responses do not currently include a Retry-After header, so start around one second and double per attempt.
  • Do not retry 400, 401, or 404 without changing the request.
  • The platform already retries transient upstream failures internally before you ever see a 502, so client-side retries can be conservative.