# Use streaming for long answers

> Why and how to use streaming with SrotGateway so long answers never time out.

Source: https://srotgateway.in/docs/streaming/

**Short answer: for anything longer than a paragraph, set `"stream": true`.**

With streaming, the answer arrives piece by piece as the model writes it. Without it, you wait for the whole answer in one go.

## Why it matters

- **No time-outs.** Some answers take many minutes, especially with thinking turned on. Many tools, proxies and HTTP libraries give up after 60–120 seconds of silence. A stream keeps data moving, so nothing cuts it off.
- **Faster feel.** Your users see the first words within seconds.
- **Same price.** Streaming costs the same as a normal call.

## What SrotGateway does to keep long calls alive

- There is **no total time limit** on a call. A call ends only if the model sends nothing at all for 5 minutes.
- While the model is thinking and no text has come yet, we send a small keep-alive every 20 seconds:
  - in a stream, a comment line starting with `:` (stream readers skip it);
  - in a normal JSON call, a space before the JSON (JSON readers ignore it).
- If the model is busy, we retry a few times for you before any answer starts.

## Token counts in a stream

We always count the real tokens. If you want them in the stream too, ask for them:

```json
{"stream": true, "stream_options": {"include_usage": true}}
```

The last piece before `[DONE]` then has a `usage` block.

## If you stop reading

If your app closes the connection in the middle, the model may keep writing for a moment; you are charged for the tokens it actually produced.
