← All docs

Streaming

Receive tokens as they are generated with server-sent events.

Enable streaming

Set "stream": true in your chat completions request. The gateway passes the provider's server-sent event (SSE) stream through to you. Each event is a data: line containing a chat completion chunk; the stream ends with data: [DONE].

curl {API}/v1/chat/completions \ -H "Authorization: Bearer nxr_live_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "provider/model-id", "messages": [{"role": "user", "content": "Write a haiku."}], "stream": true }'

Which models support streaming?

Check the model catalog — each model lists supports_streaming. Models that do not support streaming will return an error if stream is true.

Billing for streamed requests

Streaming is billed the same way as non-streaming requests: from the usage the provider reports for the completed response. If the provider reports no usage, no charge is recorded.