Early accessGnani Evon v3.5 is now available as an API to early access registrants.
Without streaming, you get the reply only when the model has finished writing it. With streaming, the reply arrives in small pieces as it is written, so your app can show the first words almost at once.
When to use this
- Chat interfaces, where waiting for the full reply feels slow.
- Voice agents, where the first words should reach the user as soon as possible.
- Long replies that you want to show as they are written.
Turn on streaming
Streaming uses the same endpoint and request body. Add"stream": true:
What the stream looks like
The response is200 OK with Content-Type: text/event-stream. Each event is a line starting with data: , followed by a blank line. The last event is data: [DONE].
To rebuild the reply, join every choices[0].delta.content in order.
Watch a stream, event by event
Options
Token usage
Streamed replies do not includeusage unless you ask for it. Send "stream_options": {"include_usage": true} to get one more chunk before [DONE]. Its choices list is empty and it carries usage:
Showing the thinking
When thinking is on, the thinking streams first indelta.reasoning and the answer follows in delta.content. OpenAI’s SDKs do not have a typed field for it, but they keep it on the delta:
Errors
Before the stream starts, errors are ordinary HTTP responses with an error status: a bad parameter, a request refused by the safety filters, a rate limit, and so on. Your code sees them before any event. See Errors. After the stream has started, the status is already200 and cannot change. If the model fails part-way, you receive one last event with the usual error object, and the stream ends without [DONE]:
[DONE] yourself in JavaScript, read the raw stream:
detect_incomplete_stream.mjs
Personal data in the reply is masked while it streams (see Safety and privacy). To catch a phone number or ID split across two chunks, a few characters are briefly held back, so text can arrive in slightly uneven pieces.
Related
Chat Completions
Every request field and the non-streamed response.
Thinking
How
delta.reasoning arrives before the answer.Tool calling
Stream tool calls and join them by
index.Errors
Error codes, and how to retry safely.