Run LLMs locally · CLI · REST API · Python · OpenAI-compatible · verified against Ollama 0.32.x (2026)

Ollama cheat sheet

Ollama runs open LLMs on your own machine with one command. ollama run llama3.2 pulls the model and drops you into a chat; a background server on :11434 exposes a REST API for apps. Package custom models with a Modelfile, call it from the Python/JS libraries, or point any OpenAI client at it unchanged. GGUF quantization keeps models small enough for laptops. Targets Ollama 0.32.x (server + CLI) and the ollama Python library.

CLI basics models & Modelfile REST API Python library config & ecosystem gotcha most common

Verified 2026-08-31 against the official docs/GitHub at ollama.com & github.com/ollama/ollama (server 0.32.x) and github.com/ollama/ollama-python. The server listens on localhost:11434; the same REST API backs the CLI, libraries, and OpenAI-compatible endpoints.

Outline

Start at the CLI, learn model management + the Modelfile, then drive the same server from the REST API, the Python library, or an OpenAI client.

CLI

  1. 1Install & first run
  2. 2Core CLI commands
  3. 3Model management

Custom models

  1. 4Modelfile

REST API

  1. 5/api/generate & /api/chat
  2. 6Embeddings

Python library

  1. 7chat / generate
  2. 8Streaming & options
  3. 9Tools & structured output

Config & ecosystem

  1. 10OpenAI compatibility
  2. 11Server config & env vars
  3. 12Ecosystem

Command Line

Install, then run and manage models entirely from the terminal.

1Install & first runone command
2Core CLI commandsdaily driver
3Model managementpull & share

Custom Models

A Modelfile bakes a base model + system prompt + parameters into a reusable model.

4Modelfilebake your own

REST API

The server on :11434 backs everything — call it directly over HTTP.

5/api/generate & /api/chatlocalhost:11434
6Embeddingsvectors

Python Library

pip install ollama — a thin, typed wrapper over the REST API.

7chat / generatepip install ollama
8Streaming & optionstoken by token
9Tools & structured outputfunction calling

Config & Ecosystem

Speak OpenAI, tune the server, and connect to the wider tooling.

10OpenAI compatibilitydrop-in
11Server config & env varstuning
12Ecosystemthe wider stack

Worth memorizing

ollama run MODELpull (if needed) + interactive chat
ollama pull/list/ps/rmmanage models & memory
:11434the server behind CLI/API/libraries
ModelfileFROM + SYSTEM + PARAMETER -> ollama create
/api/chatmulti-turn; /api/generate = single-turn
stream defaultREST streams NDJSON unless stream:false
from ollama import chatr.message.content
options={}temperature / num_ctx / num_predict / seed
tools= / format=function calling & JSON-schema output
/v1OpenAI-compatible; api_key ignored
OLLAMA_HOSTexpose beyond localhost
OLLAMA_KEEP_ALIVEhow long a model stays loaded