Skip to main content
Errors use the OpenAI error format. Match on the HTTP status and code; messages can change.

Error reference

Error messages from endpoints are never passed through. When an endpoint fails, you get a generic message such as upstream request failed.

Retrying

  • Honor the Retry-After header on 429 and 503. It’s in seconds.
  • For 502 and 500, retry with exponential backoff.
  • TokenChange already retries on other endpoints before returning an error, so retry fewer times than you would against a single server.
  • Pinned requests aren’t retried on other endpoints. Remove the pin to let TokenChange fail over.
Failed requests that delivered no output aren’t billed.

Errors after the stream starts

Once the stream has started, the status is already 200. A failure then arrives as an error event followed by data: [DONE]:
Check each event for an error field. Output delivered before the error is billed.