TESSEN Platform
Documentation
Docs/API reference
API REFERENCE

Streaming responses

Receive a chat completion as server-sent events, ending with a usage frame and `data: [DONE]`.

Set stream to true on POST /v1/chat/completions. The response is text/event-stream: one data: frame per chunk, then a final frame, then data: [DONE].

STREAM
data: {"id":"85fef9589fba4d84af7a76e0a4581c6b","object":"chat.completion.chunk","created":1793282257,"model":"z1","choices":[{"index":0,"delta":{"content":"o"},"finish_reason":null}]} data: {"id":"85fef9589fba4d84af7a76e0a4581c6b","object":"chat.completion.chunk","created":1793282257,"model":"z1","choices":[{"index":0,"delta":{"content":"k"},"finish_reason":"stop"}]} data: {"id": "85fef9589fba4d84af7a76e0a4581c6b", "object": "chat.completion.chunk", "created": 1793282257, "model": "z1", "choices": [], "usage": {"prompt_tokens": 11, "completion_tokens": 2, "total_tokens": 13, "cost_usd": 2.85e-05, "cost_provenance": "family_price", "rate_id": "commercial-v1-2026-10-25"}} data: [DONE]
FrameShape
Content chunkchoices[0].delta.content carries text. finish_reason is null until the last chunk, then stop.
Usage framechoices: [] and a usage object with prompt_tokens, completion_tokens, total_tokens. On Tessen's families it also carries cost_usd (the settled cost), cost_provenance and rate_id (the price version). It is sent whether or not you ask for it.
Terminatordata: [DONE]
Note

Reasoning text is not streamed: a reasoning model's stream carries only the answer in delta.content.

Refusals arrive inside the stream

A streamed response commits to HTTP 200 before the request is routed, so a refusal arrives as an error frame, not as an HTTP status. Its type is the code a non-streaming request would return as error.code.

ERROR FRAMES
data: {"error": {"message": "This commercial family is not available for inference", "type": "model_not_found"}} data: {"error": {"message": "Insufficient credit balance", "type": "insufficient_credits", "required_usd": 0.0032835, "available_usd": 0.0, "allowed_actions": ["top_up"]}}

Always check each frame for an error key before reading choices, as the example does.

Example

STREAMING COMPLETION
curl -N https://api.tessen.ai/v1/chat/completions \  -H "Authorization: Bearer $TESSEN_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "z1",    "stream": true,    "max_tokens": 256,    "messages": [{"role": "user", "content": "Say hello in five words."}]  }'

Search documentation

Titles, headings and guides↑ ↓ navigate · Enter open
Streaming responses · Tessen Docs