Error response format

The gateway returns errors in a consistent format:

HTTP/1.1 400 Bad Request
{
  "error": { "message": "model is required", "type": "invalid_request_error" }
}

Create task errors

HTTP statustypeMeaning
400invalid_request_errorInvalid request parameters (e.g. empty model) or upstream 4xx passthrough
401authentication_errorInvalid API key
403forbiddenAPI key IP whitelist does not allow the request IP
404not_found_errorModel has no available routes
502upstream_errorServer error

Task query errors

HTTP/1.1 404 Not Found
{
  "error": { "message": "Task not found", "type": "not_found_error" }
}

Timeouts and cancellation

  • Create task (POST): Suggested curl --max-time 30.
  • Query task (GET): Poll as needed. The SDK .task() handles polling automatically.
  • SDK abort: Passing an AbortSignal to .task() cancels polling.