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)
- OR Node.js 18+ with the OpenAI SDK (
Stream text
Stream a response and print each text token:Handle event types
A basic text response emits events in this order:response.created → response.in_progress → response.output_item.added → response.content_part.added → response.output_text.delta (repeated) → response.output_text.done → response.content_part.done → response.output_item.done → response.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 readresponse_headers before iterating. After iteration, the stream exposes the terminal event’s full response object.
Stream asynchronously
Stream with the async client:Read raw SSE
The raw wire format usesevent: and data: lines. A basic text response looks like this:
data: [DONE] format used by the other endpoint. See Error Handling for error recovery patterns.