본문으로 건너뛰기

Streaming

Per-protocol SSE start/complete, mid-stream errors, abort, retries, and where usage/cost appear. [DONE] is Chat Completions only.

Do not treat all four text protocols as one [DONE] stream. Cost headers also differ on stream.

Chat Completions#

SSE. The last event carries usage, plus cost once settlement has finished, and the stream ends with [DONE]. If cost is absent, look it up with X-Request-Id via GET /v1/generation. [DONE]

Messages#

Anthropic events. No [DONE]. X-Cost-* is omitted on stream.

Responses#

OpenAI Responses events such as response.completed. No [DONE]. Stream cost headers omitted. response.completed

Gemini#

alt=sse chunks. No [DONE]. Stream cost headers omitted. alt=sse

Retry & abort#

Provider fallback runs only before the first token. The server does not auto-retry image, video, or music generation requests. See error codes and retries & fallback for 429/503 retryable. errors · retries

Client abort#

If the client disconnects, only tokens already received are billed. Mid-stream upstream failures may arrive as SSE error events; see Errors during streaming for the frame format.