> ## 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.

# Stream termination

> The [DONE] sentinel and the optional trailing usage chunk.

## The Sentinel

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

`[DONE]` is not JSON. Every stream ends this way, including one that carried an error chunk.

## The Usage Chunk

Set `stream_options.include_usage: true` and one extra chunk arrives before `[DONE]`, with an empty `choices` array and a `usage` object:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "...",
  "object": "chat.completion.chunk",
  "created": 1751299200,
  "model": "z-ai/glm-5.2",
  "choices": [],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 17,
    "total_tokens": 41
  }
}
```

A reader that indexes `choices[0]` unconditionally fails here; check for an empty array. The usage fields match the [non-streaming response](/api/api-reference/chat-and-text/chat-completions).

## Order

1. The terminal content chunk (empty `delta`, non-null `finish_reason`).
2. The usage chunk, only if `stream_options.include_usage` was set.
3. `data: [DONE]`.

## Related

* [SSE transport](/api/api-reference/streaming-format/server-sent-events)
* [Delta format](/api/api-reference/streaming-format/delta-format)
* [Error events](/api/api-reference/streaming-format/error-events)
* [Chat Completions API](/api/api-reference/chat-and-text/chat-completions)


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