Reference · 06

Streaming

Receive incremental output over server-sent events.

Set stream to true to receive server-sent events. Metering is applied to the complete response once the stream terminates.

Python
stream = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Draft a summary."}],
    stream=True
)

for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")