Streaming
Revised
Certain API endpoints stream responses by default, such as /api/generate. These responses are provided in the newline-delimited JSON format (that is,1 the application/x-ndjson content type). For example:
{"model":"gemma4","created_at":"2025-10-26T17:15:24.097767Z","response":"That","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.109172Z","response":"'","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.121485Z","response":"s","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.132802Z","response":" a","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.143931Z","response":" fantastic","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.155176Z","response":" question","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.166576Z","response":"!","done":true, "done_reason": "stop"}
Disabling streaming
Turn off streaming by providing {"stream": false} in the request body for any endpoint that supports streaming. Responses are then returned in the application/json format instead:2
{"model":"gemma4","created_at":"2025-10-26T17:15:24.166576Z","response":"That's a fantastic question!","done":true}
When to use streaming or nonstreaming3
Streaming (default):
- Real-time response generation
- Lower perceived latency
- Better for long generations
Nonstreaming4:
- Simpler to process
- Better for short responses, or structured outputs
- Easier to handle in some applications
Notes on this page
1 Wording Audit: improved The standard writes that is in place of the Latin abbreviation.
Was:
i.e.LatinAuditor: Spelling out “that is” follows the standard and keeps the format explanation clear.
2 Wording Audit: improved Leads with the action in the active voice and the present tense (turn off in place of disable), and fixes "support" to "supports"; the meaning is unchanged.
Was:
Streaming can be disabled by providing{"stream": false}in the request body for any endpoint that support streaming. This will cause responses to be returned in theapplication/jsonformat instead:voice-active-in-instructionsvoice-present-tenseAuditor: The direct instruction is easier to follow, and “supports” fixes the grammar error.
3 Wording Audit: improved Closes the prefix and spells out the abbreviation as a plain choice.
Was:
streaming vs non-streamingClosedPrefixespunct-no-latin-abbreviationsAuditor: “Or” states the choice plainly, and “nonstreaming” uses consistent closed-prefix spelling.
4 Wording Audit: improved Closes the prefix.
Was:
Non-streamingClosedPrefixesAuditor: “Nonstreaming” uses the same closed-prefix spelling as the revised heading.
Original
Certain API endpoints stream responses by default, such as /api/generate. These responses are provided in the newline-delimited JSON format (i.e. the application/x-ndjson content type). For example:
{"model":"gemma4","created_at":"2025-10-26T17:15:24.097767Z","response":"That","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.109172Z","response":"'","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.121485Z","response":"s","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.132802Z","response":" a","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.143931Z","response":" fantastic","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.155176Z","response":" question","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:15:24.166576Z","response":"!","done":true, "done_reason": "stop"}
Disabling streaming
Streaming can be disabled by providing {"stream": false} in the request body for any endpoint that support streaming. This will cause responses to be returned in the application/json format instead:
{"model":"gemma4","created_at":"2025-10-26T17:15:24.166576Z","response":"That's a fantastic question!","done":true}
When to use streaming vs non-streaming
Streaming (default):
- Real-time response generation
- Lower perceived latency
- Better for long generations
Non-streaming:
- Simpler to process
- Better for short responses, or structured outputs
- Easier to handle in some applications
What Changed
Latin abbreviations and the hyphenated prefix are fixed, and the sentence about turning streaming off now starts with the action and fixes a grammar slip. No facts changed.
Content type: concept. The page explains how streaming responses work and when to choose each mode, with no steps beyond one setting.
Automated check, original: 0 errors, 3 warnings, 0 suggestions. Revised: 0 errors, 0 warnings, 0 suggestions.
Independent audit (GPT-6): improved. The revision fixes a grammar error and makes the streaming instructions and terminology clearer. I found no meaning changes or broken code or links.
Wording (4)
- 1 The standard writes that is in place of the Latin abbreviation. improved
- 2 Leads with the action in the active voice and the present tense (turn off in place of disable), and fixes "support" to "supports"; the meaning is unchanged. improved
- 3 Closes the prefix and spells out the abbreviation as a plain choice. improved
- 4 Closes the prefix. improved