Streaming delivers tokens as they're generated, dramatically reducing time-to-first-token and improving perceived performance. Set stream=True to receive a sequence of chunk objects.
Async Streaming with Responses API
To get token usage in a stream, pass stream_options={"include_usage": True}. The usage data arrives in the final chunk. Each streaming chunk contains a delta object with partial content, tool calls, or role information.
The right place to stream and the wrong one
Stream user-facing text — chat replies, document summarization the user is watching, anything where the human waits. Don't stream backend pipelines that just want a final string — the streaming overhead (per-chunk parsing, accumulator state) buys you nothing when no human eye is on the wire.
The cancel story matters too. Streaming responses hold an HTTP connection. If your UI lets the user 'stop generating', the abort signal must reach the SSE consumer (Python: stream.close() in a finally; JS: AbortController on fetch). Without cancel wiring, 'stop' just hides the response from view while the model finishes burning tokens server-side.