Error codes

Current public error codes emitted by the gateway and the paths that use a null code.

Reference

This reference describes codes currently emitted by the public OpenAI-compatible /v1/* surface. It is deliberately not labelled exhaustive: new endpoints or contract-tested features can add codes. See Errors for envelope and retry guidance.

Codes emitted in error.code

CodeHTTPWhen
payload_too_large413Chat or embeddings body exceeds its byte limit
invalid_body400JSON parsing or request-schema validation fails
model_not_found404The requested model slug is unknown or disabled
model_does_not_support_images400A chat request contains an image for a non-vision model
multimodal_not_supported400A chat content part has an unsupported type
tool_choice_not_supported400Forced tool selection is requested
response_format_not_supported400response_format or an SDK structured-output helper is used
concurrency_limit429The per-key in-flight request limit is reached
idempotency_conflict422One Idempotency-Key is reused for a different body
upstream_unavailable502 / 503No route is available, the breaker is open, or transport fails before a response
upstream_bad_request400Upstream returns 400
upstream_unauthorized401 / 403Upstream returns 401 or 403
upstream_model_unavailable404Upstream returns 404 for the configured model
upstream_timeout408 / 504Upstream returns a timeout status
upstream_rate_limited429Upstream returns 429
upstream_invalid_response502A non-streaming upstream response fails parsing or validation
upstream_error5xxAnother upstream or response-building failure occurs
internal_error500The global error handler catches an unexpected exception
endpoint_not_supported404An unimplemented /v1/* endpoint is requested
authentication_required401The authenticated quota endpoint has no resolved user

Paths where error.code is null

The envelope permits code: null, and several current paths use it:

  • Missing or invalid gateway credentials: HTTP 401, type: "authentication_error".
  • Per-key request throttling: HTTP 429, type: "rate_limit_exceeded".
  • AI credit balance exhaustion: HTTP 429, type: "insufficient_quota".

In particular, AI credit exhaustion does not currently emit a distinct code; branch on HTTP 429 plus type: "insufficient_quota" while accepting a null code.

Streaming exception

Once a streaming HTTP 200 response has opened, a mid-stream failure cannot return this JSON envelope. The gateway sends a chunk with finish_reason: "error", then [DONE], and records internal status 502. A client disconnect is recorded internally as 499 and sends no response to the disconnected client.

The public API does not promise a Trace-Id response header. Supply the timestamp, endpoint, model slug, status, and returned envelope when asking an operator to investigate.