Skip to content
kenari.

Streaming

kenari supports streaming on both chat endpoints. When the request body sets "stream": true, the server sends the response gradually using Server-Sent Events with Content-Type: text/event-stream. Each event is one data: line containing a JSON chunk in the native format of the API you called.

Chunk format follows the target API, not a merged format. Because of that, streams from the OpenAI-style endpoint have a different shape than streams from the Anthropic-style endpoint.

EndpointChunk formatEnd marker
POST /v1/chat/completionsOpenAI-style deltadata: [DONE]
POST /v1/messagesAnthropic-style event blocksmessage_stop event

On /v1/chat/completions, each event carries an OpenAI-style delta chunk. Model tokens accumulate in choices[0].delta.content. The stream closes with one data: [DONE] line.

Terminal window
curl -N https://kenari.id/v1/chat/completions \
-H "Authorization: Bearer kn-..." \
-H "Content-Type: application/json" \
-d '{"model":"step-3-7-flash","stream":true,"messages":[{"role":"user","content":"Hitung 1 sampai 5."}]}'

The -N flag turns off curl buffering so each event appears when it arrives, instead of waiting for the response to finish.

On /v1/messages, the stream uses Anthropic-style event blocks. The order is: message_start, then content_block_start / content_block_delta / content_block_stop pairs for each content block, then message_delta and message_stop. Model text arrives through content_block_delta.

Reasoning is not sent as a separate delta. See Reasoning for reasoning model behavior.

See also Chat completions and Messages for request body shapes and non-streaming responses.