Overview
Streaming allows you to receive response tokens as they’re generated, rather than waiting for the complete response. This dramatically improves perceived latency for your users.When to Use Streaming
- Chat interfaces — show typing indicators and real-time text
- Long responses — don’t make users wait for the full response
- Code generation — display code as it’s written
How It Works
- Set
stream: truein your request - OpenModex opens an SSE (Server-Sent Events) connection
- Tokens are sent as
data:events as they’re generated - The stream ends with
data: [DONE]