Skip to content
WP EngineDocumentation

Errors

The Power API returns standard HTTP status codes. Most error responses share a single JSON envelope; a few endpoints pass the upstream provider’s response through with its original shape and status code.

{
"error": {
"message": "model 'openai/does-not-exist' is not supported",
"type": "invalid_request_error",
"code": 400
}
}
Field Type Notes
error.message string Human-readable description.
error.type string Machine-readable category (e.g. invalid_request_error).
error.code integer Matches the HTTP status code.

401 and 403 responses on authenticated endpoints use a simpler shape:

{
"error": "missing or malformed Authorization header"
}

The WWW-Authenticate header is set on 401 responses:

WWW-Authenticate: Bearer realm="ai-services"
Status Meaning Retry?
200 Success. n/a
400 Invalid request body, parameters, or model identifier. No — fix the request.
401 Missing or invalid bearer token. No — refresh credentials.
402 No credits remaining on the account. No - purchase additional credits.
403 Valid token, but the API key lacks the required scope. No — re-issue with the correct scope.
429 Rate limit exceeded. Body is HTML, not JSON. See rate limits. Yes — back off with jitter.
502 Upstream provider returned an error or timed out. Yes — retry with backoff.

Some error responses on /v1/chat/completions, /v1/images/generations, and other provider-backed endpoints are forwarded from the upstream provider unchanged. The status code is preserved and the body may differ from the standard envelope above.

Streaming responses ("stream": true on chat completions) begin with a 200 status. If the upstream provider fails mid-stream, the connection is closed without a structured error frame.

Clients should treat an unexpected stream termination (no data: [DONE]) as a recoverable failure and retry.

If the client disconnects mid-stream, the gateway records the partial usage and stops generation; no further bytes are sent.

Last updated: