200 OK status.
Error response format
All HTTP errors follow the OpenAI error format:number | string
The HTTP status code, or a string error identifier for mid-stream errors.
string
A human-readable description of what went wrong.
object
Additional context such as provider details or internal request IDs.
HTTP error codes
Mid-stream errors
When streaming, errors can occur after the HTTP response has started. Because the connection is already open with a200 OK status, these errors appear as a chunk inside the stream with finish_reason: "error":
Retry strategies
When to retry
Exponential backoff
For transient errors (429, 500, 502, 503), retry with exponential backoff to avoid overwhelming the API:
Rate limits
If you hit429 errors frequently:
- Add delays between requests
- Reduce the number of concurrent requests
- Contact support if you need a higher rate limit
Debugging
When reporting an issue, include the following to help diagnose it faster:- The error code and message from the response body
- The model ID you were using
- The request ID from the
x-request-idresponse header (if present) - Whether the error was immediate (HTTP error) or mid-stream (
finish_reason: "error")
Authentication
Verify your API key is set up correctly.
Chat completions
Review request parameters and response format.