Set stream: true for server-sent events, in the OpenAI format. Each event is a data: line carrying one JSON chunk, and the stream ends with data: [DONE].
curl -N -X POST https://autonomousrelay.com/v1/chat/completions \
-H "Authorization: Bearer $AGENTROUTER_API_KEY" \
-H 'content-type: application/json' \
-d '{
"model": "anthropic/claude-sonnet-5",
"messages": [{"role": "user", "content": "Count to three"}],
"stream": true
}'data: {"choices":[{"delta":{"content":"One"}}]}
data: {"choices":[{"delta":{"content":", two"}}]}
data: {"usage":{"prompt_tokens":12,"completion_tokens":5}}
data: [DONE]Three things that catch people out
Usage arrives at the end
A final chunk carries usage and may have no choices at all. If your parser assumes every chunk has a delta, it will throw on the one that tells you what the request cost.
Comment lines are keepalives
A line beginning : is an SSE comment sent to hold the connection open. Ignore it rather than parsing it.
Cancelling does not always stop the meter
Whether aborting the connection stops upstream billing depends on the provider. OpenAI honours it; several others do not, and bill for the full generation. We disclose this per endpoint rather than implying a guarantee we cannot make.