# Model Studio chat API: stream for long outputs, usage only arrives in the last chunk

## TL;DR

Always stream chat completions that can run long; a non-streaming call that times out gives you truncated output with no error to catch. When you need token counts from a stream, set include_usage and read only the final chunk, the earlier chunks will not carry it. Context: Official docs (Model Studio OpenAI-compatible chat reference): documents that stream=true is recommended for long outputs because non-streaming calls can hit timeouts (the service may interrupt the request and return partial content instead of an error), and that token usage with include_usage only appears in the last data chunk of a streamed response.

Use this when you run into the situation in the title.

**When not to use this skill:** unrelated tasks. It covers only the procedure above.

## Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
