Error response structure
| Field | Meaning |
|---|---|
message | A human-readable error description, fine to show to developers |
type | Error category: invalid_request_error / authentication_error / billing_error / rate_limit_error / server_error |
param | The name of the offending field (if applicable) |
code | A machine-recognizable error code |
Common error codes
400 invalid_request
| code | Meaning |
|---|---|
invalid_request_error | Malformed request body / missing required field |
invalid_model | Model ID doesn’t exist or isn’t in the token allowlist |
context_length_exceeded | Input + output tokens exceed the model’s context window |
unsupported_modality | The model doesn’t support image / audio / video input |
401 authentication
| code | Meaning |
|---|---|
invalid_api_key | API key doesn’t exist / deleted / wrong format |
expired_api_key | The token has expired |
disabled_api_key | The token has been disabled |
403 forbidden
| code | Meaning |
|---|---|
insufficient_quota | Account or token quota exhausted |
ip_not_allowed | The source IP isn’t in the allowlist |
model_not_allowed | The token lacks permission for this model |
404 not_found
| code | Meaning |
|---|---|
model_not_found | The model doesn’t exist (retired / misspelled) |
resource_not_found | The resource (task, file) doesn’t exist |
429 rate_limit
| code | Meaning |
|---|---|
rate_limit_exceeded | RPM / TPM rate limit hit |
concurrent_limit_exceeded | Concurrency exceeds the group ceiling |
upstream_rate_limited | The upstream vendor returned a 429 |
Retry-After header (seconds); use exponential-backoff retries.
5xx server_error
| code | Meaning |
|---|---|
server_error | Internal gateway error, usually auto-retried |
upstream_unavailable | All upstream channels are unavailable |
upstream_timeout | Upstream timed out |
bad_gateway | The upstream returned an invalid response |
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.