Tarseek

Tarseek API

Streaming

Set stream: true. Response is text/event-stream with OpenAI-style data: chunks and a terminating data: [DONE].

Successful streams use stable Tarseek completion IDs, canonical model IDs, and exactly one [DONE] terminator. Set stream_options: { include_usage: true } to receive a trailing usage-only chunk when usage is available.

Stream behavior

  • Partial text in choices[].delta.content.
  • Streamed tool-call argument deltas when tools are used.
  • The final choice includes finish_reason. With include_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 a Tarseek code; Tarseek does not fail over mid-stream and does 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.

Disconnects and retries

Chat Completions streams are HTTP Server-Sent Events, not resumable sessions. Once the connection closes, Tarseek cancels upstream work, releases credit and concurrency reservations, and records the request as client-cancelled. Start a new request; Tarseek does not replay missing tokens.

Retry automatically only when no application-visible chunk was received. If text or a tool-call delta arrived, treat the answer as partial. X-Client-Request-Id is for log correlation, not deduplication.