Streaming
Server-Sent Events in the OpenAI chunk format, for every provider.
Format
Set "stream": true. Each event is data: {...} with an object: "chat.completion.chunk" payload. Deltas carrycontent, tool_calls or reasoning. The final content chunk sets finish_reason; a trailing chunk with an emptychoices array carries usage; the stream ends with data: [DONE].
data: {"id":"gen-...","object":"chat.completion.chunk","model":"anthropic/claude-haiku-4.5","provider":"Anthropic","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"1 2 3"},"finish_reason":null}]}
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":18,"completion_tokens":9,"total_tokens":27,"cost":0.000063}}
data: [DONE]Keepalive comments
While an upstream is thinking, ElevenRouter may send SSE comment lines (: ELEVENROUTER PROCESSING) so proxies keep the connection open. SSE parsers ignore comments; make sure yours does too.
Errors mid-stream
If an upstream fails before any output was sent, another endpoint is tried transparently. If it fails after output started, the stream ends with an error event data: {"error": {...}} and no [DONE]. Only the tokens actually produced are billed.
Cancelling
Closing the connection cancels the upstream request. Tokens generated up to that point are billed and the generation is marked cancelled.