Skip to content
Last updated

Server-Sent Events (SSE) streamed when using stream: true in the request.

Event Types

response.created

Sent when the response is created and processing begins.

Show data structure

id string required

The response ID.

status string required

Always in_progress.

Example:

{"id":"resp_abc123","status":"in_progress"}

response.output_item.added

Sent when a new output item (e.g., message) is added to the response.

Show data structure

index integer required

The index of the output item.

item object required

The output item being added.

type string - The type of item (e.g., message)

Example:

{"index":0,"item":{"type":"message"}}

response.output_text.delta

Sent for each text chunk as it's generated.

Show data structure

index integer required

The index of the output item.

delta string required

The text chunk being streamed.

Example:

{"index":0,"delta":"Hello"}

response.output_text.done

Sent when text generation is complete.

Show data structure

text string required

The complete generated text.

Example:

{"text":"Hello! How can I help you?"}

response.completed

Sent when the entire response is complete.

Show data structure

status string required

Always completed.

Example:

{"status":"completed"}

response.failed

Sent if the response fails.

Show data structure

status string required

Always failed.

error object required

Error information.

Example:

{"status":"failed","error":{"message":"Rate limit exceeded","code":"rate_limit"}}

Usage

These events are streamed by:

Examples

event: response.created
data: {"id":"resp_abc123","status":"in_progress"}

event: response.output_item.added
data: {"index":0,"item":{"type":"message"}}

event: response.output_text.delta
data: {"index":0,"delta":"Hello"}

event: response.output_text.delta
data: {"index":0,"delta":"! How can I"}

event: response.output_text.delta
data: {"index":0,"delta":" help you?"}

event: response.output_text.done
data: {"text":"Hello! How can I help you?"}

event: response.completed
data: {"status":"completed"}