Skip to main content
Each streaming event carries a type field like response.output_text.delta or response.completed. The stream ends with a terminal event (response.completed, response.incomplete, or response.failed) instead of a data: [DONE] sentinel.

Prerequisites

  • An Auriko API key
  • Python 3.10+ with the OpenAI SDK (pip install openai) or the Auriko SDK (pip install auriko)
    • OR Node.js 18+ with the OpenAI SDK (npm install openai) or @auriko/sdk (npm install @auriko/sdk)

Stream text

Stream a response and print each text token:

Handle event types

A basic text response emits events in this order: response.createdresponse.in_progressresponse.output_item.addedresponse.content_part.addedresponse.output_text.delta (repeated) → response.output_text.doneresponse.content_part.doneresponse.output_item.doneresponse.completed

Lifecycle events

Content events

Reasoning events

Tool call events

Error event

Terminal events (response.completed, response.incomplete, response.failed) carry the final response object with usage and routing_metadata.

Access completed response

You can read response_headers before iterating. After iteration, the stream exposes the terminal event’s full response object.
cURL streams raw SSE events. See Read raw SSE for parsing terminal events. For routing metadata with the OpenAI SDK, see OpenAI Compatibility.

Stream asynchronously

Stream with the async client:
TypeScript’s SDK is inherently async. See the Stream text example above.

Read raw SSE

The raw wire format uses event: and data: lines. A basic text response looks like this:
See Chat Completions streaming for the data: [DONE] format used by the other endpoint. See Error Handling for error recovery patterns.