Open an SSE stream
Enable stream: true and disable client buffering. The server sends data events as response parts become available.
Process the stream incrementally: one event does not have to contain completed text or a complete tool call.
SSE stream
bash
curl --no-buffer --request POST https://cicora.ai/api/v1/chat/completions \
--header "Authorization: Bearer $CICORA_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "openai/gpt-5.6-sol",
"stream": true,
"stream_options": {"include_usage": true},
"messages": [{"role": "user", "content": "Write a three-line poem."}]
}'Assemble deltas
- Accumulate text by choice/index or item identifier.
- Collect tool arguments as a stream of JSON fragments and parse them after completion.
- When final metrics matter, explicitly enable the available usage option in the stream.
Finish and cancel
Treat the stream as complete only after a terminal event. A connection closing without one is a distinct failure path.
Attach an AbortController or equivalent to user navigation so an unused request does not remain open.