Streaming
Server-sent events, usage in streams and streams that fail midway.
- Can I resume a stream from where it stopped?No resume endpoint exists. Retry the request; or send the partial answer back and ask the model to continue.FAQ
- How do I get token usage from a stream?Set stream_options.include_usage to true; a final chunk carries usage. The last content chunk carries it too.How-to
- How do I stream Model API output through nginx or another proxy?Turn off response buffering for the route and raise read timeouts, so events pass through as they arrive.How-to
- How do tool calls look in a stream?They arrive as delta.tool_calls fragments: join arguments by index until finish_reason is tool_calls.How-to
- How does reasoning appear in a stream?Max and Heavy stream reasoning as delta.reasoning_content before the answer in delta.content. It's billed as output.Explainer
- How does streaming work on the Model API?stream: true returns server-sent events in the OpenAI chunk format, ending with data: [DONE].Explainer
- How quickly does the first token arrive?On Flash, typically about a second. Max and Heavy reason first, so visible answer text starts later.FAQ
- My stream arrives all at once instead of word by word. Why?Something between you and the API is buffering: curl without -N, a proxy, or a framework that collects the body.Troubleshooting
- My stream stopped without data: [DONE]. What happened?The connection dropped before the stream finished. Treat the answer as incomplete and retry.Troubleshooting
- Should I use streaming?Stream for anything a person waits on, and for long outputs. Skip it for short background jobs.FAQ
- What errors can happen during a stream?Before the stream starts you get a normal HTTP error. After it starts, an error event then data: [DONE].Reference
- What exactly does a Model API stream look like?Lines starting with data: carrying chat.completion.chunk JSON, an optional usage chunk, then data: [DONE].Reference
Still need help?
Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.
Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyzFor deleting your whole account or the data of one service.