> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openserv.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream a response

> Display SERV output as it arrives over server-sent events.

<Frame>
  <img src="https://mintcdn.com/openserv/wCXyJJTiOX6drWSJ/images/tutorials/streaming.webp?fit=max&auto=format&n=wCXyJJTiOX6drWSJ&q=85&s=4113b1618a27f4746faf94feeeed7fb6" alt="Response particles arriving incrementally through a streaming pipeline" width="1536" height="1024" data-path="images/tutorials/streaming.webp" />
</Frame>

Set `stream: true` and iterate over the returned stream.

```js theme={null}
const stream = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  stream: true,
  messages: [
    { role: "system", content: "You are a concise technical writer." },
    { role: "user", content: "Explain database indexes in three paragraphs." },
  ],
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
```

Streaming is supported by Chat Completions, Responses, and Messages. Shadow-agent validation requires a completed response.
