TokenRouteDocs
Sign in

Streaming

Stream responses with Server-Sent Events.

Set stream: true to receive tokens incrementally as Server-Sent Events. Each event is a data: line containing a chunk; the stream ends with data: [DONE]. The final chunk carries the usage object.

bash
curl https://tokenroute.app/api/v1/chat/completions \
  -H "Authorization: Bearer $TOKENROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "openai/gpt-4o-mini", "messages": [{"role":"user","content":"Hi"}], "stream": true }'