Error format
Provider client errors can include sanitized actionable detail. Provider server errors remain generic and credentials are redacted.
Streaming
Chat and Responses support Server-Sent Events. Normalized streams finish withdata: [DONE]. The gateway closes the provider stream and completes usage, budget, and request-log finalization before sending that terminal frame. Responses streams preserve event names such as response.created and response.completed.
A provider failure after streaming begins is sent as a separately framed SSE error because the HTTP status has already been committed, including when the provider disconnected during an unterminated event. Raw UTF-8 characters may span transport chunks and are decoded incrementally. Applications must handle error objects inside the stream as well as connection failures.
Client disconnects close the upstream stream and trigger cancellation-shielded usage/budget finalization. Usage fields accumulate across provider events; an empty trailing usage object does not discard previously observed counts. Terminal usage still depends on provider support, and budget settlement is conservative when usage is missing.
Request correlation
SendX-Request-ID using 1-128 letters, digits, ., _, :, or -, beginning with an alphanumeric character. Invalid values are replaced with a generated UUID. Log the response X-Request-ID for support and reconciliation.