stream: true on any chat completion request. The response is a sequence of server-sent events that render tokens as the model produces them — reducing time-to-first-token.
- Python
- Node
- curl
Streamed chunks arrive as
data: {...}\n\n SSE frames terminated by data: [DONE]. Most SDKs parse this for you.Tool calls in streams
When the model calls a tool,tool_calls arrives across multiple chunks. Accumulate function.arguments string fragments until the chunk with finish_reason: "tool_calls".
See tool calling for a complete example.