Skip to main content
On error, OpenPAI returns a standard HTTP status code plus a JSON error body. The error structure is fully compatible with OpenAI’s, so it plugs seamlessly into existing SDK error handling.

Error response structure

Common error codes

400 invalid_request

401 authentication

403 forbidden

404 not_found

429 rate_limit

The 429 response includes a Retry-After header (seconds); use exponential-backoff retries.

5xx server_error

5xx errors are not billed (if the upstream already generated tokens, they’re settled by actual usage).

Errors during streaming

If a streaming response errors midway, it sends an error event as SSE and then closes the connection:
The client should watch for the error field in the SSE data, not just the HTTP status code.

Retry guidance

Reporting issues

When you get an error you can’t make sense of:
  1. Copy the X-OpenPAI-Request-Id from the response headers.
  2. Search for that ID in Console → Logs to see metadata like the model, token usage and error code.
  3. If you still can’t pin it down, record the Request ID and reproduction steps for later investigation.