Overview
When streaming is enabled in V3, LLM responses are delivered via Server-Sent Events (SSE), providing real-time token-by-token output. Benefits:- Immediate response feedback
- Better user experience with progressive display
- Lower perceived latency
Server-Sent Events Format
SSE responses follow this pattern:data: followed by JSON or the [DONE] marker.
Python with OpenAI SDK
JavaScript with Fetch API
Chunk Structure
Each JSON chunk follows OpenAI’s format:Key Fields
Finish Reasons
Next Steps
Plans & Pricing
Understand how streaming usage is billed