API Reference
Streaming
Set "stream": true to receive the response as server-sent events. Each event is a chat.completion.chunk with a token delta; the stream ends with a [DONE] sentinel.
SSE
data: {"id":"04976a9bdc7f47c8a9ab07da2a1a5783","object":"chat.completion.chunk","created":1784286015,"model":"deepseek-v4-flash","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"04976a9bdc7f47c8a9ab07da2a1a5783","object":"chat.completion.chunk","created":1784286016,"model":"deepseek-v4-flash","choices":[{"index":0,"delta":{"content":"One"},"finish_reason":null}]}
data: {"id":"04976a9bdc7f47c8a9ab07da2a1a5783","object":"chat.completion.chunk","created":1784286016,"model":"deepseek-v4-flash","choices":[{"index":0,"delta":{"content":", two, three."},"finish_reason":null}]}
data: {"id":"04976a9bdc7f47c8a9ab07da2a1a5783","object":"chat.completion.chunk","created":1784286016,"model":"deepseek-v4-flash","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"04976a9bdc7f47c8a9ab07da2a1a5783","object":"chat.completion.chunk","created":1784286016,"model":"deepseek-v4-flash","choices":[],"usage":{"prompt_tokens":8,"completion_tokens":44,"total_tokens":52}}
data: [DONE]Streamed calls are billed the same way. Usage is recorded once the response finishes, even if the connection drops mid-stream.
Some models stream a "reasoning" phase (a reasoning_content delta) before the visible content deltas begin. Expect a few chunks with no content while a reasoning model is thinking.