Skip to content
DOCUMENTATION / API

Streaming

Server-sent events, ending with data: [DONE].

Set stream to true to receive the answer as server-sent events in OpenAI chunk format. The stream ends with data: [DONE].

CURL
curl -N https://api.tessen.ai/v1/chat/completions \
  -H "Authorization: Bearer $TESSEN_ZERO_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "project-zero",
    "stream": true,
    "messages": [{ "role": "user", "content": "Explain this regular expression: ^\\d{3}-\\d{4}$" }]
  }'

Refusals during a stream

A streaming response commits to HTTP 200 before the request is routed, so a refusal arrives as an error event in the stream instead of an HTTP status. Its type is the same code a non-streaming request would return.

JSON
data: {"error": {"message": "The Zero Pool is at capacity. It resets daily.", "type": "zero_capacity_unavailable", "capacity_state": "…", "reset_at": "…"}}
Idempotency-Key is not honoured for streaming requests; retrying a stream may run it again.
Streaming — Tessen Docs