Streaming Responses
Watch tokens arrive in real-time using Server-Sent Events (SSE).Enable Streaming
Set"stream": true in your request:
Response Format (SSE)
Instead of a single JSON response, you receive a stream of events:Key Points
- Each line starts with
data: - Content arrives in
delta.contentfragments - Stream ends with
data: [DONE] - Empty lines separate events
Parsing Streaming Responses
Accumulating Full Response
If you need the complete text:Streaming Response Schema
See Also
- examples/02_streaming.py - Runnable example
- Streaming with Tools - Tool calls in streams