Ollama's /api/generate and /api/chat endpoints stream JSON and can disable streaming
Answer: Ollama serves an HTTP API on the local server at http://localhost:11434/api. The generate endpoint returns a stream of JSON objects by default. Set stream to false when you want a single response object.
Generate and streaming
The GitHub API doc describes generate as a streaming endpoint for a given prompt and model. The final streamed object includes statistics. A no-streaming request is just the same call with streaming turned off.
Chat, local, and OpenAI-compatible URLs
The site docs give the local base URL http://localhost:11434/api and the OpenAI compatibility URL http://localhost:11434/v1. For local inference they show http://localhost:11434/api/chat and say to omit the authorization header. Cloud requests use an API key; local requests do not.
Claims
- id: C1 claim: Streaming can be turned off with stream set to false. source: S1 evidence: "Streaming can be disabled by providing
{\"stream\": false}"
- id: C2 claim: Generate is a streaming endpoint for a prompt and model. source: S1 evidence: "Generate a response for a given prompt with a provided model"
- id: C3 claim: The local Ollama API base is http://localhost:11434/api. source: S2 evidence: "http://localhost:11434/api"
- id: C4 claim: Local chat calls can use /api/chat without an authorization header. source: S2 evidence: "use http://localhost:11434/api/chat"
Sources
- [S1] Ollama API. ollama/ollama (GitHub). https://github.com/ollama/ollama/blob/main/docs/api.md . License: MIT. Accessed 2026-11-18.
- [S2] Ollama API (docs.ollama.com). Ollama (docs.ollama.com). https://docs.ollama.com/api . License: MIT. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: ollama/ollama (GitHub), Ollama API, MIT (https://raw.githubusercontent.com/ollama/ollama/main/LICENSE); Ollama (docs.ollama.com), Ollama API (docs.ollama.com), MIT (https://raw.githubusercontent.com/ollama/ollama/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: ollama/ollama (GitHub), Ollama API, MIT (https://raw.githubusercontent.com/ollama/ollama/main/LICENSE); Ollama (docs.ollama.com), Ollama API (docs.ollama.com), MIT (https://raw.githubusercontent.com/ollama/ollama/main/LICENSE).
Cite this
iinventedlight. 2026. "Ollama's /api/generate and /api/chat endpoints stream JSON and can disable streaming." iinventedlight Library, iil:note:21xvqq9q, version of 2026-11-18. https://iinventedlight.com/library/notes/ollama-api-generate/. License: CC-BY-4.0.
@misc{iil_note_21xvqq9q,
author = {{iinventedlight}},
title = {{Ollama's /api/generate and /api/chat endpoints stream JSON and can disable streaming}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/ollama-api-generate/},
note = {Permanent ID iil:note:21xvqq9q. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ollama-api-generate.md.