Errors
The two error shapes by surface, in-stream errors, and the full status code table
The API returns different error shapes depending on the surface you call. Match your handler to the surface.
OpenAI-style errors
The OpenAI-style endpoints (/v1/chat/completions, /v1/models, /v1/files, /v1/audio) return the OpenAI-canonical nested error object. OpenAI SDKs and gateways (Bifrost, LiteLLM) parse it as error.message out of the box.
{
"error": {
"message": "Invalid API key format.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}The error.type and error.code follow the HTTP status.
| Status | error.type | error.code |
|---|---|---|
| 400, 403, 404, 413 | invalid_request_error | null |
| 401 | invalid_request_error | invalid_api_key |
| 429 | rate_limit_error | rate_limit_exceeded |
| 500+ | server_error | null |
A request body that fails validation returns 400 with a single collapsed message ("messages: Field required"), the same as OpenAI. The request ID is on the X-Request-Id response header.
Talos-specific endpoints
Endpoints outside the OpenAI standard (for example /v1/audit) keep the flat legacy envelope:
{
"error": "Audit rate limit exceeded.",
"code": "HTTP_429",
"request_id": "req_..."
}In-stream errors
When an inference error happens mid-stream, the stream emits one error chunk and then closes with [DONE].
{
"error": {
"message": "inference backend unavailable",
"type": "service_unavailable",
"code": "inference_error"
}
}data: [DONE]Anthropic-style errors
The Anthropic-style endpoints (messages and batches) return the Anthropic error shape.
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "max_tokens is required"
}
}The error.type is mapped from the HTTP status.
| Status | error.type |
|---|---|
| 400 | invalid_request_error |
| 422 | invalid_request_error |
| 401 | authentication_error |
| 403 | permission_error |
| 404 | not_found_error |
| 413 | request_too_large |
| 429 | rate_limit_error |
| 500 | api_error |
| 503 | overloaded_error |
| 529 | overloaded_error |
Status codes
| Code | When it occurs |
|---|---|
| 200 | Success |
| 201 | Resource created (for example a file or batch) |
| 204 | Success with no body (for example a delete) |
| 400 | Malformed or invalid request |
| 401 | Missing or invalid API key |
| 403 | Key lacks permission, or 0 agent slots |
| 404 | Unknown path or resource |
| 413 | Request body exceeds the context cap |
| 415 | Unsupported media type |
| 422 | Request failed validation |
| 429 | Rate limit, concurrency, slot, or budget exceeded |
| 500 | Internal error |
| 502 | Upstream gateway error |
| 503 | Service unavailable. Carries Retry-After |