Ollama Cheatsheet - run, pull, Modelfile & API

Ollama solves a narrow engineering problem: making a model reproducible rather than "it works on my machine". It folds downloads, quantisation format, GPU offload layers, context length, Modelfile customisation and an OpenAI-compatible server into one command surface, so upgrading a model no longer means recompiling llama.cpp flags and CI no longer needs a cached binary. The decision rule is blunt - use it when data must not leave the machine, when you need to pin an exact quantisation build, or when peak concurrency justifies owning the GPU; otherwise a hosted API is cheaper. Only three things genuinely need configuring: putting SYSTEM and PARAMETER blocks in a Modelfile so behaviour versions alongside the weights, creating named variants with create instead of retyping a long run invocation, and running ollama serve as a resident process with the right port and keep-alive so application code can talk to it over the standard OpenAI protocol.

AI CLI·25 commands·Last updated 2026-08-21
ollamaaiclilocalllmLocal Models

Run & Chat 5

ollama run llama3.1
Pull and enter interactive chat
ollama run llama3.1 "summarize in one line"
Single prompt then exit
ollama run -m
Set run parameters (e.g. context)
ollama serve
Start the local inference server (default 11434)
ollama ps
Show models currently running

Model Management 5

ollama pull <model>
Pull a model locally
ollama push <model>
Push a model to the registry
ollama list
List installed models
ollama rm <model>
Remove a local model
ollama cp <src> <dst>
Copy a model (rename/branch)

Modelfile 5

FROM llama3.1
Base model in a Modelfile
PARAMETER temperature 0.7
Set sampling temperature
SYSTEM "You are a rigorous assistant"
Set the system prompt
TEMPLATE """{{ .Prompt }}"""
Custom chat template
ollama create mymodel -f Modelfile
Build a model from a Modelfile

Serve & Port 5

ollama serve
Start the inference server in foreground
OLLAMA_HOST=0.0.0.0 ollama serve
Allow LAN access
curl http://localhost:11434/api/generate
Call the generate API
ollama show <model>
Inspect model metadata/template
ollama embeddings
Generate text embeddings

Tips 5

ollama run llama3.1 -c 4096
Cap context to save VRAM
ollama list | head
Quick peek at installed models
ollama run --verbose
Show token-speed diagnostics
ollama ps to watch VRAM
Monitor VRAM with ollama ps
ollama run <m> "translate..."
Use a local model as an offline translator

Tips

  • Ollama is the de-facto local runtime; a "local model" entry covers privacy/offline/zero-API-cost cases that complement cloud CLIs.
  • Bake behavior into a Modelfile SYSTEM/PARAMETER — more stable and versionable than repeating system instructions in prompts.
  • Tight on VRAM? Cap context with -c or watch parallel usage with ollama ps to avoid OOM.
  • For programmatic use run ollama serve + the REST API instead of interactive mode.

FAQ

What are the most common Ollama commands?

The daily drivers are ollama run <model> to pull and chat interactively, ollama pull <model> to download without running, ollama list to see local models, ollama ps for running models, ollama create to build a custom model from a Modelfile, and ollama serve to expose models as an OpenAI-compatible API on localhost:11434.

How do I download and run a model with Ollama?

Run something like ollama run llama3.2 — if the model is not local it is pulled from the library automatically, then you drop into a chat. To download only, use ollama pull <model>.

How do I run Ollama as an API server?

ollama serve starts a local server on port 11434 with an OpenAI-compatible /v1 API. You often do not need to start it manually because ollama run brings the backend up on demand. Point your OpenAI client base URL at http://localhost:11434 to use it.

How do I list my local Ollama models and see what is running?

ollama list shows every pulled model with size and modified time; ollama ps shows only models currently loaded in memory. Remove one with ollama rm <model>.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Aug 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us