Tarseek API · Pre-production
Streaming
Set stream: true. Response is text/event-stream with OpenAI-style data: chunks and a terminating data: [DONE].
[DONE] terminator. Set stream_options: { include_usage: true } to receive a trailing usage-only chunk when usage is available.Production guarantees
- Partial text in
choices[].delta.content. - Streamed tool-call argument deltas when tools are used.
- The final choice includes
finish_reason. Withinclude_usage, a trailing choices-free chunk contains normalized usage. - Exactly one terminal
[DONE]after a successful stream. - Validation and routing errors detected before streaming use the normal JSON error body.
- Errors after bytes have been sent: SSE error event with Tarseek code; do not failover to another provider mid-stream; do not emit
[DONE]as if the answer completed. - Comment heartbeats (
: ping) keep quiet streams and proxies alive. They carry no model data and SSE clients should ignore them. - The first upstream event must arrive within 30 seconds, no upstream event may be silent for more than 30 seconds, and the whole provider attempt is capped at 120 seconds by default.
event: error carrying the standard error body and no[DONE], so clients cannot mistake a failed stream for success.Disconnects and retries
Chat Completions streams are HTTP Server-Sent Events, not resumable sessions. A brief network disturbance may be hidden by TCP, but once the connection closes Tarseek cancels upstream work, releases concurrency admission, and records the request as client-cancelled. The client must start a new request; Tarseek does not replay missing tokens or continue from aLast-Event-ID because doing so could duplicate text or tool calls.
Retry automatically only when no application-visible chunk was received. If text or a tool-call delta arrived, treat the answer as partial and decide explicitly whether to display, discard, or replace it. X-Client-Request-Id is for log correlation, not deduplication.
