Skip to main content
All errors follow a consistent envelope, modeled after the OpenAI error shape so existing client libraries parse them cleanly.

Error envelope

Status codes

Sub-codes

Sub-codes give you programmatic branches without parsing messages. Common values:

Handling errors

Branch on type for user-facing messages; branch on code for programmatic behavior:

Streaming errors

When streaming (stream: true), fatal errors arrive as a response.failed SSE event, not an HTTP error:
See Streaming for the full event list.