Skip to main content
Set stream to true to receive incremental output. Clients should handle a complete stream and a terminal event.

Chat Completions stream

Each data frame is JSON with the Chat Completions chunk shape. The stream terminates with:
Accumulate choices[0].delta.content and stop when the [DONE] marker arrives. Usage can be returned in the final usage chunk when enabled by the model configuration.

Responses stream

POST /v1/responses uses named events:
  • response.output_text.delta contains a text fragment in delta.
  • response.completed marks successful completion and includes the public model and usage summary.
Unknown events should be ignored so your client remains forward-compatible.

Cancellation and retries

  • Abort the HTTP request when the user stops generation.
  • Do not retry a stream after partial output unless your application can safely start a new request.
  • Retry a connection failure or 502/503 with exponential backoff and jitter.
  • Do not retry 400, 401, 403, or 404 without changing the request or credentials.
  • Treat 429 as a policy response and wait using the reset headers when present.

Streaming safety

Treat all streamed text as untrusted model output and render it safely in your application.