Public preview: This API is in public preview. Endpoints, schemas, and limits may change before general availability.

Streaming

How EU GPT streams responses as Server-Sent Events, and when streaming is the right call.

EU GPT streams responses as Server-Sent Events (SSE) by default. The SDKs hide the wire format, but it helps to know what is on the wire.

When to stream#

You wantChoose
To render output as the model produces it (chat UIs, dashboards).stream: true
The shortest time to the first words of the answer.stream: true
A single JSON document you can JSON.parse or .json().stream: false
Back-end batch jobs that do not need partial output.stream: false

Streaming reduces perceived latency: the first words arrive while the rest is still being written, and a full answer can take many seconds. The first text takes longer when the model first searches the web or reads documents, but tool activity shows up in the stream right away. For anything user-facing, stream.

The wire format#

The HTTP response has Content-Type: text/event-stream. The body is a sequence of events separated by blank lines:

event: message
data: {"type":"response.created","sequence_number":1,"response":{…}}

event: message
data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{…}}

event: message
data: {"type":"response.content_part.added","sequence_number":3,…}

event: message
data: {"type":"response.output_text.delta","sequence_number":4,…,"delta":"Hello"}

: ping - 2026-11-02 12:00:15.012345+00:00

event: message
data: {"type":"response.output_text.delta","sequence_number":5,…,"delta":", world"}

event: message
data: {"type":"response.output_text.done","sequence_number":6,…,"text":"Hello, world"}

event: message
data: {"type":"response.completed","sequence_number":7,"response":{…,"output_text":"Hello, world"}}
  • Every data: line is one JSON object with a type and a sequence_number. The full taxonomy is in Streaming events.
  • Lines end with \r\n, so events are separated by \r\n\r\n. Standard SSE clients handle this; if you parse by hand, see Handling streams.
  • Lines that start with : are comments. EU GPT sends a : ping comment every 15 seconds to keep the connection open. Ignore them.

Ordering and gaps#

  • response.created is always the first event, with sequence_number 1.
  • sequence_number goes up by one with every event.
  • The stream ends with response.completed, with response.incomplete when the answer was cut off by max_output_tokens, or with an error event.
  • An error event means the response failed, even if a response.completed event still follows it.
  • The connection closes (server-side) after the last event.

Buffering and proxies#

Some HTTP proxies and load balancers buffer responses, defeating the point of streaming. If your application sits behind a custom proxy:

  • Disable response buffering on routes that forward /v1/responses.
  • For Nginx, set proxy_buffering off; and proxy_cache off; on that location.
  • For Cloudflare workers, set cache: "no-store" and avoid Response wrapping that re-reads the body.

The EU GPT edge does not buffer streams.

Server-side timeouts#

  • A single request can run for at most 10 minutes. After that the connection is closed, so break very long jobs into smaller calls.
  • If the model you named has not started answering after 45 seconds, EU GPT switches to another model and reports it with a response.model.fallback event (see Models).
  • Because of the 15-second pings, a connection that stays completely silent for a minute is dead: disconnect and retry.

Parsing the stream#

You almost never need to parse SSE by hand:

  • JavaScript: use the openai SDK’s AsyncIterable interface.
  • Python: use the openai SDK’s stream=True mode, which yields parsed events.
  • Other languages: any standard SSE client will work. The data: payload is a JSON object.

For hand-rolled parsers, see Handling streams.