Streaming
Get the reply piece by piece as it is written, so people see the answer straight away.
Base URLhttps://api.kalle.build/v1AuthBearer kalle_sk_…VersionKalle-Version: 2026-11-01
Stream a message
Set stream to true. The response is a stream of server-sent events. The SDKs give you a helper that yields the text as it arrives.
POST/v1/messages
curl https://api.kalle.build/v1/messages --no-buffer \
-H "Authorization: Bearer $KALLE_API_KEY" \
-H "Kalle-Version: 2026-11-01" \
-H "Content-Type: application/json" \
-d '{
"model": "kalle-turbo-max",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Write a short welcome text for a yoga studio in Copenhagen."
}
],
"stream": true
}'Event types
| Event | When |
|---|---|
message_start | Once, with the message ID and model |
content_block_start | When a text or tool block starts |
content_block_delta | Each new piece of text, in delta.text |
content_block_stop | When a block is finished |
message_delta | At the end, with stop_reason and final usage |
message_stop | The last event |
ping | Sent every 15 seconds to keep the connection open |
Raw events
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Welcome to "}}
event: message_stop
data: {"type":"message_stop"}Errors during a stream
If something goes wrong after the stream has started, you get an error event with the same shape as a normal error, and the stream ends.