Skip to main content
Errors use standard HTTP status codes and a consistent body.
string
Broad category: invalid_request_error, authentication_error, rate_limit_error, api_error or upstream_error.
string
Specific machine-readable cause. Branch on this, not on the message.
string
Human-readable explanation. Wording may change; do not parse it.
string
The offending request field, when the error is attributable to one.

Status codes

Retrying

Retry 429, 500, 502 and 503. Do not retry 4xx other than 429, since the same request will fail the same way. Use exponential backoff with jitter, and respect x-ratelimit-reset-requests on a 429 rather than guessing an interval.
Retrying a completion bills again. Cap attempts, and make sure a retry loop around a streaming call does not silently double a long generation’s cost.

Upstream failures

A 502 or 503 carries upstream_unavailable: the provider behind the model failed. Protégé does not silently substitute a different model, because a substitution you did not ask for is a quality change you did not approve. Include x-request-id from the failed response when reporting it.