Skip to main content

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.content fragments
  • 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