Skip to main content
A failed request returns an HTTP status and a JSON body in OpenAI’s error shape:
Branch on code. The message is for people and can change.

Common codes

Retry a 429 or a 503 after the seconds in its Retry-After header, when it has one. Retry a 502 after a short wait. Don’t retry a 400, 401, 403, or 404 unchanged. A retried request that reached the model is a new request, and Morse bills it again. Each endpoint’s page in the API reference lists every code it can return. See Create a chat completion.