Streaming
ShareSet stream: true to receive Server-Sent Events (SSE). KiteRouter streams the upstream response back to your client and appends gateway headers such as X-Request-Id.
Streaming Examples
1curl https://kiterouter.com/api/v1/chat/completions \
2 -H "Authorization: Bearer kr-your-api-key" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "gpt-4o-mini",
6 "messages": [{"role": "user", "content": "Tell me a short joke."}],
7 "stream": true
8 }'Stream Chunk Format
1data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]} 2 3data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]} 4 5data: [DONE]
Info: Usage is recorded for billing. When the upstream provider sends usage in the stream, KiteRouter uses that; otherwise it estimates usage from the request and response.