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: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:- Copy the
X-OpenPAI-Request-Idfrom the response headers. - Search for that ID in Console → Logs to see metadata like the model, token usage and error code.
- If you still can’t pin it down, record the Request ID and reproduction steps for later investigation.