API reference
Streaming responses with server-sent events
POST /v1/conversation/stream returns server-sent events: response.started, response.completed and error. How to consume the stream from curl, Node and the browser.
Updated
/v1/conversation/stream accepts exactly the same body as /v1/conversation and answers with text/event-stream. /v1/messages streams too when you send "stream": true. Use streaming to keep connections alive on long generations and to show progress in your UI.
Events
Consuming the stream
Each event is event: <name> followed by one data: <json> line and a blank line. The snippet below parses frames as they arrive; EventSource cannot send POST bodies, so use fetch and read the body stream.
Streaming requests count once towards your rate limit and record one usage row, just like any other request. Request ids are returned in the x-request-id header as well.
Frequently asked questions
- Does /v1/messages stream?
- Yes: send
"stream": truein the body of /v1/messages and you receive the same event set. /v1/conversation/stream is the dedicated endpoint for multi-turn threads. - Why no token-by-token deltas?
- The gateway normalises the provider stream into a small, stable event set. Your client stays simple and the response shape never changes between streaming and non-streaming calls.