Skip to main content

Overview

Set stream: true to receive responses as Server-Sent Events (SSE). Each event contains a partial response chunk, allowing you to display content in real-time as it’s generated.

Stream Format

The stream sends data: lines containing JSON objects:

Chunk Object

Each chunk contains:

Examples

Aborting a Stream

You can cancel an in-progress stream: