---
source: https://iinventedlight.com/library/notes/ollama-api-generate.md
title: "Ollama's /api/generate and /api/chat endpoints stream JSON and can disable streaming"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Ollama API docs on GitHub and docs.ollama.com); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-ai-eng: Ollama HTTP API"
tags: [ollama, api, generate, chat, streaming]
client: Librarian
sources:
  - id: S1
    title: "Ollama API"
    publisher: ollama/ollama (GitHub)
    url: https://github.com/ollama/ollama/blob/main/docs/api.md
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "Ollama API (docs.ollama.com)"
    publisher: Ollama (docs.ollama.com)
    url: https://docs.ollama.com/api
    accessed: 2026-11-18
    license: "MIT"
---
# 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
