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

# Server-Sent Events transport

> Headers, frame format, heartbeat, and termination for streamed chat completions.

With `stream: true`, the reply is a Server-Sent Events stream. The chunk payload is in [Delta format](/api/api-reference/streaming-format/delta-format).

## Headers

The gateway writes `200` immediately, then streams:

| Header | Value |
| - | - |
| `Content-Type` | `text/event-stream; charset=utf-8` |
| `Cache-Control` | `no-store, no-cache` |
| `X-Accel-Buffering` | `no` |

`X-Accel-Buffering: no` disables proxy buffering. An initial heartbeat follows the `200`.

## Frames

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
data: <json>\n\n
```

The payload is a `chat.completion.chunk`. Frames are separated by a blank line. Parse each `data:` line as JSON, except the terminal sentinel.

## Heartbeat

Every 15 seconds the gateway emits a comment frame:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
: keep-alive\n\n
```

SSE clients ignore comment lines; a hand-written parser should skip lines starting with `:`.

## Termination

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
data: [DONE]\n\n
```

`[DONE]` is not JSON. With `stream_options.include_usage`, a usage chunk precedes it. See [Stream termination](/api/api-reference/streaming-format/stream-termination).

Fusion is batched. [Encrypted](/api/api-reference/chat-and-text/encrypted) streams as a passthrough of the provider's encrypted deltas.

## Related

* [Delta format](/api/api-reference/streaming-format/delta-format)
* [Tool call streaming](/api/api-reference/streaming-format/tool-call-streaming)
* [Error events](/api/api-reference/streaming-format/error-events)
* [Stream termination](/api/api-reference/streaming-format/stream-termination)
* [Streaming (feature guide)](/api/features/streaming)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.