Requests (API)

Streaming (SSE)

Add "stream": true — and the response streams as server-sent events (SSE), token by token.

Streaming formats

  • OpenAI surface: chat.completion.chunk chunks; the final chunk carries the usage counter.
  • Anthropic surface: native events message_start → content_block_delta → message_delta → message_stop.

Billing during streaming

Billing and logging happen even if the client drops mid-stream — tokens already spent upstream are never lost.

Telegram