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 status | type | Meaning |
|---|---|---|
| 400 | invalid_request_error | Invalid request parameters (e.g. empty model) or upstream 4xx passthrough |
| 401 | authentication_error | Invalid API key |
| 403 | forbidden | API key IP whitelist does not allow the request IP |
| 404 | not_found_error | Model has no available routes |
| 502 | upstream_error | Server 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): Suggestedcurl --max-time 30. - Query task (
GET): Poll as needed. The SDK.task()handles polling automatically. - SDK abort: Passing an
AbortSignalto.task()cancels polling.