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
| Event | Description |
|---|---|
response.created | Response object created, status is in_progress |
response.in_progress | Processing has started |
response.completed | Response finished, includes final response object |
response.incomplete | Response stopped early (token limit, content filter) |
response.failed | Response failed, includes error details |
Content events
| Event | Description |
|---|---|
response.output_item.added | New output item started (text, function call, or reasoning) |
response.output_item.done | Output item finished |
response.content_part.added | New content part within an output item |
response.content_part.done | Content part finished |
response.output_text.delta | Text chunk, access via event.delta |
response.output_text.done | Text output complete, access full text via event.text |
Reasoning events
| Event | Description |
|---|---|
response.reasoning_summary_part.added | Reasoning summary part started |
response.reasoning_summary_part.done | Reasoning summary part finished |
response.reasoning_summary_text.delta | Reasoning summary text chunk |
response.reasoning_summary_text.done | Reasoning summary text complete |
Tool call events
| Event | Description |
|---|---|
response.function_call_arguments.delta | Function call arguments chunk |
response.function_call_arguments.done | Function call arguments complete |
Error event
| Event | Description |
|---|---|
error | Stream-level error |
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.