Skip to main content
Set stream: true to receive semantic Server-Sent Events instead of waiting for one final JSON response. Use this when you want to render text progressively, react to tool calls early, or inspect structured lifecycle events.

Enable Streaming

Event Lifecycle

Per the protocol tests, a normal text stream looks like this:
The final text is reconstructed by concatenating the delta values from response.output_text.delta events.

What to listen for

  • response.output_text.delta for visible text
  • response.function_call_arguments.delta for tool arguments
  • response.completed for the final snapshot
  • [DONE] for the stream terminator

Manual SSE Parsing Example

Tool Call Streaming

When the model emits a tool call, the stream includes argument deltas such as response.function_call_arguments.delta followed by response.function_call_arguments.done.

Error Events

If an error occurs after headers are already sent, the stream may emit an error event and then a failed terminal event before [DONE].

Common mistakes

  • treating the stream as plain text instead of parsing structured events
  • ignoring tool or reasoning deltas because the client only listens for text
  • forgetting that usage and the final response snapshot arrive at the end, not in each text delta