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

StatusMeaningClient action
400Invalid request or unsupported modelCorrect the request; refresh /v1/models if the model is unknown
401Missing or invalid credentialReplace or refresh the credential
402Account is out of model-API creditsAdd credits, then retry
429Key, account, or provider limitHonor Retry-After when present and back off
502Upstream model request failedRetry cautiously if the operation is safe
529Model temporarily overloadedRetry 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.

Copyright © 2026