The Definitive Ollama Masterclass
Run any open model, for any task, locally. Every install path across macOS, Windows, Linux, Docker, and Cloud — a job-organized model catalog with real pull commands — the API, the Modelfile, editor integrations, and paste-ready playbooks. Current to Ollama v0.31.1.
Quick Answer
Ollama is free, open-source software that runs open models — Gemma, Qwen, Llama, DeepSeek, gpt-oss and more — locally on macOS, Windows, and Linux, with an optional hosted Cloud tier for models too big for your hardware. Install it in one command, pull a model with ollama pull, and chat with ollama run. Every prompt stays on your machine; there are no subscriptions, rate limits, or per-token bills. This class is the cross-platform, current, end-to-end guide: every install path, the right model for each job, the API and Modelfile, editor integrations, and paste-ready playbooks.
Key takeaways
- One command installs Ollama on any OS; a second pulls a model. You are chatting locally in minutes.
- Pick the model by the job, not the hype: coding, reasoning, vision, embeddings, small/edge, tool-calling, and specialized lanes each have a best-in-class pick.
- VRAM is the constraint. A 12 GB GPU runs 7–14B models fast; CPU-only runs the small ones; the giants run on Cloud.
- Local and Cloud are different trust models: local never leaves your machine, Cloud runs on Ollama's servers.
- Every install exposes a local API at
localhost:11434, including an OpenAI-compatible endpoint — so your editor, scripts, and apps just point at it. - A Modelfile turns any base model into a reusable, constrained assistant you load by name.
What Ollama Is in 2026
Under the hood, Ollama runs on the llama.cpp backend and now ships an MLX backend for Apple Silicon, with GPU acceleration through CUDA on NVIDIA, ROCm on AMD, and Vulkan as a broad fallback. As of v0.31.1 it supports current families including Gemma 4, Qwen 3.5, Llama, DeepSeek, gpt-oss, and cloud-scale models like Kimi, GLM, and MiniMax.
Two things changed the product recently and matter for vibe coders. First, the bare ollama command now offers to wire itself into coding agents — Claude Code, Codex, Copilot CLI, Droid, and OpenCode — via ollama launch. Second, Ollama Cloud lets you run models far too large for local hardware on Ollama's servers, marked cloud in the library. The rest of the ecosystem — REST API, OpenAI-compatible endpoint, Python and JS SDKs, Modelfiles, GGUF import — is unchanged and stable.
Local vs Cloud, stated plainly. A local model runs on your machine and nothing leaves it. A Cloud model runs on Ollama's servers — convenient for 200B–700B models, but not private in the same way. This class labels every model so you always know which you are using.
New here and on Windows? The Ollama for Windows companion covers the Windows-specific tray app and RTX 3060 benchmarks in depth. This class is the cross-platform, model-and-task superset.
Hardware & VRAM Reality
Ollama defaults to roughly 4-bit quantization, which compresses a model to about a quarter of its full-precision size. A useful rule of thumb: the download size plus about 20% for the context cache is what you need in memory. When a model exceeds your VRAM, Ollama automatically splits layers between GPU and system RAM — it still runs, just slower.
| Model size | Approx. download | VRAM to run fast | CPU-only RAM | Typical hardware |
|---|---|---|---|---|
| 1–3B | 0.7–2 GB | 2–4 GB | 8 GB | Any GPU, or CPU-only |
| 7–8B | 4–5 GB | 6–8 GB | 16 GB | RTX 4060 8 GB, RTX 3060 12 GB |
| 12–14B | 7–9 GB | 10–14 GB | 16–32 GB | RTX 3060 12 GB (tight), 4080 16 GB |
| 27–35B | 16–22 GB | 22–30 GB | 32–64 GB | RTX 3090/4090 24 GB |
| 70B | 38–42 GB | 40–48 GB | 64 GB+ | 2×24 GB, or workstation |
| 100B–700B | — | — | — | cloud Ollama Cloud |
The three practical tiers
- CPU-only ($0 extra): any modern quad-core with 8–16 GB RAM runs 1–8B models at readable speed. Great for learning, small tasks, and edge models.
- 12 GB GPU (the vibe-coder sweet spot): an RTX 3060 12 GB runs 7–14B models with full acceleration — the best balance of quality and speed for local coding and RAG.
- 24 GB GPU or Apple Silicon: 24 GB runs 27–35B locally; Apple Silicon uses unified memory, so a 32–64 GB Mac runs surprisingly large models via the MLX backend.
Two quick wins. Put models on an SSD (loading from a spinning disk is painfully slow), and set OLLAMA_KV_CACHE_TYPE=q8_0 to roughly halve context-cache memory so a larger context fits on a smaller GPU.
Install: Every Path
macOS
- Install. Run the one-line script, or download the app.
- Verify.
ollama --versionprints the version;ollama listconfirms the service runs. - First model.
ollama run gemma4downloads and starts a chat. Apple Silicon uses the MLX backend automatically.
# Install (script) β or download the app from ollama.com/download/Ollama.dmg curl -fsSL https://ollama.com/install.sh | sh # Verify ollama --version ollama list # Run your first model (Apple Silicon uses MLX automatically) ollama run gemma4
Watch for: on Intel Macs without a discrete GPU, prefer smaller models (1–8B). The .dmg app and the script install the same runtime.
Windows
- Install. Run the PowerShell one-liner, or download and run
OllamaSetup.exe. No administrator rights are required; it installs into your home directory and adds a tray icon. - Custom location. To install elsewhere, run the installer with the
/DIRflag. To move where models are stored, setOLLAMA_MODELS. - Portable. Prefer no installer? Download
ollama-windows-amd64.zipfrom the GitHub releases, unzip anywhere, and runollama.exe. - GPU. Vulkan is enabled by default; ROCm is available for AMD and CUDA for NVIDIA.
# Install (PowerShell one-liner) irm https://ollama.com/install.ps1 | iex # Or run the installer to a custom directory (Command Prompt) OllamaSetup.exe /DIR="D:\Ollama" # Move model storage to a big drive (set, then restart Ollama) setx OLLAMA_MODELS "D:\ollama\models" # Verify + first model ollama --version ollama run gemma4
Watch for: some AMD RX 6000-class cards do not expose ROCm on current Windows drivers — Ollama falls back to Vulkan automatically. The deep-dive tray walkthrough and RTX 3060 benchmarks live in the Windows companion class.
Linux (script + manual + systemd)
- Fast path. The install script detects your GPU and sets up a systemd service.
- Manual path. Prefer control? Download the tarball, extract to
/usr, and runollama serve. Verify the exact filename at docs.ollama.com/linux. - Service. Create a systemd unit so Ollama starts on boot and restarts on failure.
- AMD. For ROCm GPUs, install the ROCm build variant as documented on the same page.
# Fast path β detects GPU, installs a systemd service curl -fsSL https://ollama.com/install.sh | sh # Verify ollama --version ollama run gemma4
# Manual install (verify filename at docs.ollama.com/linux) curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz sudo tar -C /usr -xzf ollama-linux-amd64.tgz # Create a dedicated user and a systemd service sudo useradd -r -s /bin/false -m -d /usr/share/ollama ollama sudo tee /etc/systemd/system/ollama.service >/dev/null <<'UNIT' [Unit] Description=Ollama Service After=network-online.target [Service] ExecStart=/usr/bin/ollama serve User=ollama Group=ollama Restart=always Environment="OLLAMA_HOST=127.0.0.1:11434" [Install] WantedBy=multi-user.target UNIT sudo systemctl daemon-reload sudo systemctl enable --now ollama
Watch for: the systemd service runs as the ollama user, so its model directory differs from your shell user's. Set OLLAMA_MODELS in the unit's Environment= if you want a shared location.
Docker (CPU, NVIDIA, AMD)
- CPU. Run the official
ollama/ollamaimage with a named volume for models and the port mapped. - NVIDIA. Install the NVIDIA Container Toolkit, then add
--gpus=all. - AMD. Use the
:rocmimage and pass the render devices. - Run a model. Exec into the container:
docker exec -it ollama ollama run gemma4.
# CPU docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama # NVIDIA GPU (needs nvidia-container-toolkit) docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama # AMD ROCm docker run -d --device /dev/kfd --device /dev/dri \ -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm # Pull + run a model inside the container docker exec -it ollama ollama run gemma4
Add a chat UI with Open WebUI
# ChatGPT-style UI bundled with Ollama, GPU build β then open http://localhost:3000 docker run -d -p 3000:8080 --gpus=all \ -v ollama:/root/.ollama -v open-webui:/app/backend/data \ --name open-webui --restart always \ ghcr.io/open-webui/open-webui:ollama # CPU-only: drop the --gpus=all flag
Package managers
Ollama is packaged for most ecosystems. Homebrew and Arch are the most common; Nix, Flox, Gentoo, Guix, and a Helm chart for Kubernetes are all official-listed on the project README.
# macOS / Linux β Homebrew brew install ollama brew services start ollama # Arch Linux sudo pacman -S ollama # Nix (ephemeral shell) nix-shell -p ollama # Kubernetes β Helm chart helm repo add ollama-helm https://otwld.github.io/ollama-helm/ helm install ollama ollama-helm/ollama
Which to pick? Use your platform's native package if you already manage software that way; otherwise the official install script gives you the fastest GPU auto-detection.
Libraries & build from source
For building apps, install the official SDKs. To hack on Ollama itself, build from source with Go and CMake (see the development docs).
# Python pip install ollama # JavaScript / TypeScript npm i ollama
Ollama Cloud (no local install)
- When to use it. For models too large for your hardware — the 100B–700B frontier models tagged cloud in the library.
- How. Sign in, then run a cloud-tagged model with the same
ollama runcommand, or call the API with your key. See ollama.com/pricing. - Trade-off. Cloud runs on Ollama's servers, so it is not private the way a local model is. Use it for scale, keep sensitive work local.
# Sign in, then run a cloud-scale model by its cloud tag ollama signin ollama run deepseek-v4-pro # Cloud models expose the same local API surface at localhost:11434
Sources: github.com/ollama/ollama (README), docs.ollama.com (linux, windows), ollama.com/download. Verified Ollama v0.31.1, 2026-06-29.
First Run & the Core CLI
run, pull, list, ps, and rm first; reach for show, cp, create, and serve as you go. New in 2026: ollama launch wires Ollama straight into a coding agent.ollama pull gemma4 # download a model ollama run gemma4 # download if needed, then chat ollama list # list installed models + sizes ollama ps # show what is loaded in GPU/CPU right now ollama show gemma4 # architecture, parameters, license, context ollama rm gemma4 # delete a model to free disk ollama cp gemma4 my-gemma # copy a model under a new name ollama serve # run the API server in the foreground ollama launch claude # wire Ollama into Claude Code (also: codex, opencode, droid, copilot-cli) # Inside the chat REPL: # /set parameter num_ctx 8192 -> change context length # /show info -> model details # /bye -> exit
The REPL accepts multi-line input with triple quotes and lets you tweak parameters live with /set. Everything runs on your hardware; watch ollama ps to confirm a model is on the GPU rather than spilling to CPU.
Configuration & Performance
| Variable | What it does | Typical value |
|---|---|---|
| OLLAMA_MODELS | Where models are stored. Point at your largest drive. | D:\ollama\models |
| OLLAMA_HOST | Bind address and port for the API server. | 127.0.0.1:11434 |
| OLLAMA_KEEP_ALIVE | How long a model stays loaded after use. -1 keeps it resident. | 5m or -1 |
| OLLAMA_CONTEXT_LENGTH | Default context window for loaded models. | 8192 |
| OLLAMA_FLASH_ATTENTION | Enable flash attention for lower memory and higher speed. | 1 |
| OLLAMA_KV_CACHE_TYPE | Quantize the context cache to fit more context in less VRAM. | q8_0 |
| OLLAMA_NUM_PARALLEL | Concurrent requests served per model. | 1–4 |
| OLLAMA_MAX_LOADED_MODELS | How many models may be resident at once. | 1–3 |
| CUDA_VISIBLE_DEVICES | Which NVIDIA GPUs to use in a multi-GPU box. | 0,1 |
A tuned local profile
# Fit more context on a 12 GB GPU and keep the model hot export OLLAMA_FLASH_ATTENTION=1 export OLLAMA_KV_CACHE_TYPE=q8_0 export OLLAMA_CONTEXT_LENGTH=8192 export OLLAMA_KEEP_ALIVE=-1 export OLLAMA_MODELS="$HOME/ollama-models" # On Windows PowerShell, use: setx OLLAMA_FLASH_ATTENTION 1 (etc.), then restart Ollama ollama serve
Quantization, briefly
A model's quantization is how tightly its weights are compressed. Ollama defaults to a 4-bit variant, the best speed-to-quality balance for local use. Pull a specific quantization with a tag, for example ollama pull qwen2.5-coder:14b-instruct-q8_0 for higher fidelity at the cost of memory, or a smaller q4 to fit a bigger model on a small card. The show command prints the quantization a model is using.
The Model Catalog, by Job
ollama pull command and a start-here size. The full library is 150+ models and grows weekly — browse it at ollama.com/library, read the tags (tools vision thinking cloud), and ollama pull anything. local runs on your machine; cloud runs on Ollama's servers.Find and run any model
# 1) Browse ollama.com/library and note a model name + size tag # 2) Pull a specific size/quant with a tag after the colon ollama pull qwen2.5-coder:14b # 3) Run it ollama run qwen2.5-coder:14b # 4) Inspect what you got (context, quant, license) ollama show qwen2.5-coder:14b
General & chat flagships
| Model | Sizes | Best for | Start here |
|---|---|---|---|
| gemma4 local | e2b–31b | Google's frontier-per-size all-rounder; vision + tools + thinking | 12b on 12 GB |
| qwen3.5 local | 0.8b–122b | Multimodal, strong reasoning and multilingual | 9b on 12 GB |
| llama3.3 local | 70b | Meta flagship-class instruction following | 70b on 48 GB |
| gpt-oss local | 20b / 120b | OpenAI open weights; agentic + reasoning | 20b on 16 GB |
| mistral-small3.2 local | 24b | Fast, capable, good function calling + vision | 24b on 24 GB |
| granite4.1 local | 3b–30b | Enterprise: RAG, tools, JSON output (Apache 2.0) | 8b on 12 GB |
ollama pull gemma4 ollama pull qwen3.5 ollama pull gpt-oss:20b ollama pull mistral-small3.2 ollama pull granite4.1:8b
Coding (the vibe-coder core)
| Model | Sizes | Best for | Start here |
|---|---|---|---|
| qwen2.5-coder local | 0.5b–32b | The local workhorse: generation, completion, fixing | 7b or 14b on 12 GB |
| devstral local | 24b | Agentic multi-file coding, codebase exploration | 24b on 24 GB |
| codestral local | 22b | Mistral's code model; fast fill-in-the-middle | 22b on 24 GB |
| deepseek-coder-v2 local | 16b / 236b | Strong multi-language MoE; big-context refactors | 16b on 16 GB |
| qwen3-coder cloud | 30b / 480b | Long-context agentic coding at frontier scale | Cloud |
| codegemma local | 2b / 7b | Lightweight completion on modest hardware | 7b on 8 GB |
ollama pull qwen2.5-coder:14b ollama pull devstral ollama pull codestral ollama pull deepseek-coder-v2
Reasoning (thinking models)
| Model | Sizes | Best for | Start here |
|---|---|---|---|
| deepseek-r1 local | 1.5b–671b | Chain-of-thought; shows its reasoning steps | 8b or 14b on 12 GB |
| qwq local | 32b | Qwen's dedicated reasoner | 32b on 24 GB |
| magistral local | 24b | Efficient reasoning with tool use | 24b on 24 GB |
| phi4-reasoning local | 14b | Punches above its size on math and logic | 14b on 14 GB |
| deepscaler local | 1.5b | Tiny math specialist for constrained hardware | 1.5b anywhere |
ollama pull deepseek-r1:14b ollama pull qwq ollama pull phi4-reasoning
Vision & multimodal
| Model | Sizes | Best for | Start here |
|---|---|---|---|
| qwen3-vl local | 2b–235b | Strongest Qwen vision-language; charts, docs, UI-to-code | 8b on 12 GB |
| llama3.2-vision local | 11b / 90b | Image reasoning, document understanding | 11b on 12 GB |
| llava local | 7b–34b | General visual Q&A, captioning | 7b on 8 GB |
| moondream local | 1.8b | Tiny vision model for edge devices | 1.8b anywhere |
| deepseek-ocr local | 3b | Token-efficient OCR from scans and receipts | 3b on 8 GB |
ollama pull qwen3-vl:8b ollama pull llama3.2-vision ollama pull moondream
Embeddings (for RAG)
| Model | Size | Best for | Note |
|---|---|---|---|
| nomic-embed-text local | — | The default general-purpose embedder; large context | Fast, tiny |
| embeddinggemma local | 300m | Google's compact embedder for on-device RAG | Efficient |
| mxbai-embed-large local | 335m | Higher-quality retrieval when accuracy matters | Stronger |
| bge-m3 local | 567m | Multilingual, multi-granularity retrieval | Multilingual |
| qwen3-embedding local | 0.6b–8b | Scales embedding quality with size | Tunable |
ollama pull nomic-embed-text ollama pull embeddinggemma ollama pull mxbai-embed-large
Small & edge (low VRAM / CPU)
| Model | Sizes | Best for | Start here |
|---|---|---|---|
| gemma3 local | 270m–4b | Tiny-but-capable; 270m runs almost anywhere | 1b on CPU |
| llama3.2 local | 1b / 3b | Fast general chat on modest hardware | 3b on CPU/8 GB |
| phi4-mini local | 3.8b | Reasoning + function calling in a small footprint | 3.8b on 8 GB |
| smollm2 local | 135m–1.7b | Ultra-light experiments and edge devices | 360m on CPU |
| granite4 local | 350m–3b | Low-latency enterprise tasks with tools | 3b on 8 GB |
ollama pull gemma3:1b ollama pull llama3.2:3b ollama pull phi4-mini ollama pull smollm2:360m
Tool-calling & agentic
| Model | Sizes | Best for | Start here |
|---|---|---|---|
| functiongemma local | 270m | Purpose-built function calling in a tiny model | 270m anywhere |
| hermes3 local | 3b–405b | Flagship open tool-use / agent behavior | 8b on 12 GB |
| command-r local | 35b | Long-context RAG + tool use | 35b on 24 GB |
| llama3-groq-tool-use local | 8b / 70b | Tuned specifically for function calling | 8b on 12 GB |
ollama pull hermes3:8b ollama pull functiongemma ollama pull llama3-groq-tool-use
Specialized (math, SQL, translation, safety)
| Model | Job | Note |
|---|---|---|
| mathstral local | Math & scientific reasoning | 7b, Mistral |
| sqlcoder local | Text-to-SQL generation | 7b / 15b |
| translategemma local | Translation across 55 languages | 4b–27b |
| llama-guard3 local | Safety classification of inputs/outputs | 1b / 8b |
| shieldgemma local | Content-safety policy evaluation | 2b–27b |
| nuextract local | Structured information extraction | 3.8b |
ollama pull mathstral ollama pull sqlcoder ollama pull llama-guard3
Cloud-only frontier models
These run on Ollama Cloud, not your GPU. They are 100B–700B-class and marked cloud in the library. Use them for frontier quality; keep sensitive work on local models.
| Model | Best for |
|---|---|
| kimi-k2.6 cloud | Native-multimodal agentic model; long-horizon coding + orchestration |
| glm-5.2 cloud | Flagship agentic engineering; long-horizon tasks |
| minimax-m3 cloud | Coding + agentic with a 1M-token context |
| deepseek-v4-pro cloud | Frontier MoE with multiple reasoning modes |
Source: ollama.com/library (popular + newest), read 2026-06-29. Sizes and tags reflect that snapshot; the library changes weekly — verify before quoting.
Modelfile & Custom Models
# Save as "Modelfile" (no extension) FROM qwen2.5-coder:14b SYSTEM """You are a senior Shopify + React engineer. Write production-ready code with error handling. Vanilla JS only, no jQuery. Scope all CSS under a unique wrapper class. When unsure, say so and propose a test rather than guessing.""" PARAMETER temperature 0.3 PARAMETER num_ctx 8192 # Build and run it: # ollama create shopify-dev -f Modelfile # ollama run shopify-dev
Import your own weights
# Point FROM at a local GGUF file (or a safetensors directory) echo 'FROM ./my-model.gguf' > Modelfile ollama create my-model -f Modelfile ollama run my-model # Share it to your namespace on ollama.com ollama push yourname/my-model
See the Modelfile reference and import guide for every instruction, including TEMPLATE, ADAPTER for LoRA, and quantization on import.
The API & SDKs
http://localhost:11434 with a REST API and an OpenAI-compatible endpoint. This is the whole point for builders: your editor, scripts, and apps all talk to one local engine — no keys, no rate limits, no per-token bills.| Endpoint | Method | Purpose |
|---|---|---|
/api/chat | POST | Multi-turn chat with message history (streaming supported) |
/api/generate | POST | Single-turn completion |
/api/embed | POST | Vector embeddings for RAG and semantic search |
/api/tags | GET | List installed models |
/api/ps | GET | Show loaded models |
/v1/chat/completions | POST | OpenAI-compatible drop-in |
Chat from the shell
curl http://localhost:11434/api/chat -d '{
"model": "gemma4",
"messages": [{ "role": "user", "content": "Why is the sky blue?" }],
"stream": false
}'Python
# pip install ollama
from ollama import chat
resp = chat(model='qwen2.5-coder:14b', messages=[
{'role': 'system', 'content': 'You output only valid JSON.'},
{'role': 'user', 'content': 'Give me a product with name and price.'}
], format='json') # force structured JSON output
print(resp.message.content)
# Embeddings for RAG:
from ollama import embed
vec = embed(model='nomic-embed-text', input='chunk of text')['embeddings']JavaScript
// npm i ollama
import ollama from 'ollama';
const res = await ollama.chat({
model: 'gemma4',
messages: [{ role: 'user', content: 'Plan a week of social posts.' }],
});
console.log(res.message.content);OpenAI drop-in
Point any OpenAI client at the local endpoint and most code — plus LangChain, LlamaIndex, and CrewAI — works unchanged.
# pip install openai
from openai import OpenAI
client = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama') # key ignored
resp = client.chat.completions.create(
model='qwen2.5-coder:14b',
messages=[{'role': 'user', 'content': 'Explain how Ollama works.'}],
)
print(resp.choices[0].message.content)Structured + tools. Pass format: json (or a JSON schema) to force machine-parseable output, and use a tools-tagged model with a tools array for function calling. Full details in the API reference.
Editor & Agent Integrations
ollama launch, which wires Ollama directly into a coding agent. For editors, Continue and Cline are the go-to extensions; anything OpenAI-compatible points at localhost:11434/v1.Native agent launch (new)
# Wire Ollama into a coding agent in one command ollama launch claude # Claude Code ollama launch codex # Codex ollama launch opencode # OpenCode ollama launch droid # Droid ollama launch copilot-cli # GitHub Copilot CLI # Turn Ollama into a personal assistant across chat apps ollama launch openclaw
The editor landscape
| Tool | What it is | How to connect |
|---|---|---|
| Continue | AI assistant for VS Code + JetBrains | Select Ollama as provider, choose your local model |
| Cline | Autonomous multi-file / whole-repo coding | Set API provider to Ollama; Plan then Act |
| Void / Zed | AI-native editors, Cursor alternatives | Point the model provider at Ollama |
| Aider | Terminal pair-programmer | Set the Ollama API base and model |
| Open WebUI / AnythingLLM | Chat + local RAG desktop apps | Auto-detect Ollama at localhost:11434 |
| Antigravity | Agent-first IDE (see the DDS class) | Use Ollama as the local validation lane |
# ~/.continue/config.yaml β point Continue at your local Ollama
models:
- name: Qwen Coder (local)
provider: ollama
model: qwen2.5-coder:14b
- name: Autocomplete (local)
provider: ollama
model: qwen2.5-coder:1.5b
roles: [autocomplete]export OLLAMA_API_BASE=http://127.0.0.1:11434 aider --model ollama/qwen2.5-coder:14b
Task Playbooks
1. A private local coding copilot
ollama pull qwen2.5-coder:14b # chat/edit model ollama pull qwen2.5-coder:1.5b # fast autocomplete # Install the Continue extension, select Ollama, pick the models above. # Result: tab completion + inline chat, fully local, zero cloud calls.
Best on a 12 GB GPU. Drop to qwen2.5-coder:7b on 8 GB.
2. Private RAG over your own documents
ollama pull nomic-embed-text # embedder
ollama pull gemma4 # answerer
# Fastest GUI path: install AnythingLLM or Open WebUI, point at Ollama,
# drop your files in, and ask questions grounded in them.
# Script path (Python):
from ollama import embed, chat
docs = ["...your chunks..."]
vectors = [embed(model='nomic-embed-text', input=d)['embeddings'][0] for d in docs]
# store vectors in any vector DB, retrieve top-k for a query, then:
answer = chat(model='gemma4', messages=[{'role':'user','content':'CONTEXT + QUESTION'}])Everything stays local — the entire point of RAG on Ollama for sensitive data.
3. Agentic multi-file coding
ollama pull devstral # coding-agent model (24B, needs ~24 GB) ollama launch opencode # or use Cline in VS Code with Ollama # Give it a bounded task, review the plan, then let it edit across files. # On 12 GB, use qwen2.5-coder:14b instead and keep tasks smaller.
Keep changes reviewable: bounded task, read the plan, commit yourself.
4. Vision & OCR extraction
ollama pull qwen3-vl:8b # general vision-language
ollama pull deepseek-ocr:3b # token-efficient OCR
# CLI: pass an image path in the REPL, or via the API:
from ollama import chat
r = chat(model='qwen3-vl:8b', messages=[{
'role':'user','content':'Extract the totals from this receipt as JSON.',
'images':['receipt.jpg']}], format='json')
print(r.message.content)Use deepseek-ocr for dense scans; qwen3-vl for reasoning about charts and UI.
5. Batch, offline text operations
from ollama import chat
items = open('inbox.txt').read().split('\n---\n')
for i, text in enumerate(items):
r = chat(model='gemma4', messages=[
{'role':'system','content':'Classify as [urgent], [fyi], or [archive]. One label only.'},
{'role':'user','content': text}])
print(i, r.message.content.strip())No rate limits, no bill — run thousands of items overnight on local hardware.
6. Structured JSON extraction
from ollama import chat
r = chat(model='granite4.1:8b', messages=[
{'role':'system','content':'Return only JSON matching {name, email, company}.'},
{'role':'user','content':'Jane Doe, jane@acme.co, works at Acme.'}
], format='json')
import json; print(json.loads(r.message.content))Pair format='json' with a tools-capable model for reliable machine output.
7. Sovereign fallback (local primary, cloud backup)
from ollama import chat
def ask(prompt, sensitive=True):
model = 'qwen2.5-coder:14b' if sensitive else 'qwen3-coder' # local vs cloud
return chat(model=model, messages=[{'role':'user','content':prompt}]).message.content
# Sensitive work never leaves the machine; non-sensitive scale routes to Cloud.The pattern behind zero-cost sovereign operation — expanded in the AI Cost Engineering class.
Ops & Guardrails
Update & maintain
- Update Ollama: re-run the install script or installer. On Homebrew,
brew upgrade ollama. - Update a model:
ollama pull nameagain — only changed layers download. - Reclaim disk:
ollama listto see sizes,ollama rm nameto delete. Models run tens to hundreds of GB. - Keep models hot:
OLLAMA_KEEP_ALIVE=-1avoids reloading from disk between requests.
Exposing the API. By default Ollama listens on localhost only. Setting OLLAMA_HOST=0.0.0.0:11434 opens it to your whole network with no authentication. Only do this behind a firewall or a reverse proxy that adds auth — never on an untrusted network.
Guard an agentic setup
When a local model can call tools or act on files, screen its inputs and outputs. Ollama ships safety models for exactly this: llama-guard3 and shieldgemma classify prompts and responses against safety policies, and granite4.1-guardian judges harm criteria. Run the model's output through a guard before any side effect, the same discipline any production agent needs.
# macOS: quit the app, then remove it and the models rm -rf ~/.ollama # Linux (script install): sudo systemctl disable --now ollama sudo rm /usr/bin/ollama /etc/systemd/system/ollama.service sudo rm -rf /usr/share/ollama # Windows: uninstall from Settings > Apps, then delete %USERPROFILE%\.ollama
Troubleshooting Matrix
ollama ps — it tells you whether a model is on the GPU or spilling to CPU, which explains most speed problems.| Symptom | Likely cause | Fix |
|---|---|---|
| Very slow tokens | Model on CPU, not GPU (check ollama ps) | Update GPU drivers; use a smaller size that fits VRAM; enable flash attention |
| Out of memory / crash | Model too big for VRAM | Smaller size or lower quant; OLLAMA_KV_CACHE_TYPE=q8_0; reduce num_ctx |
| AMD RX 6000 on Windows, no GPU | ROCm not exposed on current drivers | Vulkan is the automatic fallback; leave it enabled |
| "port already in use" 11434 | Ollama already running (tray app or service) | Use the running instance, or stop it before ollama serve |
| Long pause on first prompt | Model loading from disk | Put models on SSD; set OLLAMA_KEEP_ALIVE=-1 |
| Disk filling on C: (Windows) | Default model dir in home drive | Set OLLAMA_MODELS to a big drive and restart |
| Cannot reach API from another device | Bound to localhost only | Set OLLAMA_HOST=0.0.0.0 behind a firewall; open the port deliberately |
| Vision model ignores the image | Non-vision model, or image not attached | Use a vision-tagged model and pass the image in the request |
Sources: docs.ollama.com (windows, faq), github.com/ollama/ollama. Verified 2026-06-29. Re-check version-specific behavior after any Ollama update.
Frequently Asked Questions
What is Ollama and is it free?
Ollama is free, open-source software for running open models locally on macOS, Windows, and Linux. Once a model is downloaded it runs entirely on your machine with no subscription and no data leaving your computer. It also offers an optional hosted Cloud tier for models too large to run locally.
Which operating systems does Ollama support?
macOS, Windows, and Linux natively, plus Docker on all three. On Windows it installs without administrator rights into your home directory and uses Vulkan by default, with ROCm available for AMD and CUDA for NVIDIA.
What is the fastest way to install Ollama?
On macOS or Linux, run curl -fsSL https://ollama.com/install.sh | sh. On Windows, run irm https://ollama.com/install.ps1 | iex in PowerShell, or download and run OllamaSetup.exe. Then ollama pull gemma4 and ollama run gemma4.
What hardware do I need for Ollama?
A CPU-only machine with 8 to 16 GB of RAM runs 1B to 8B models at usable speeds. A 12 GB GPU such as an RTX 3060 runs 7B to 14B models fast. 24 GB runs 30B-class models. Apple Silicon uses unified memory. Models too big for local hardware run on Ollama Cloud.
What is the difference between local models and Ollama Cloud?
Local models run on your own GPU or CPU and never leave your machine. Ollama Cloud runs very large models, such as the biggest DeepSeek, GLM, Kimi, and MiniMax models, on Ollama's servers when they are too large for local hardware. Cloud models are marked cloud in the library and are not private in the same way as local models.
What is the best Ollama model for coding?
For local coding on a 12 GB GPU, qwen2.5-coder in its 7B or 14B size is the workhorse, with devstral and codestral strong for agentic multi-file work. Larger coding models such as qwen3-coder and the cloud coding models are available when you have more VRAM or use Cloud.
How do I connect Ollama to my code editor?
Use the Continue or Cline extensions in VS Code or JetBrains and select Ollama as the provider, or run ollama launch to wire Ollama into Claude Code, Codex, Copilot CLI, Droid, or OpenCode directly. Any tool that speaks the OpenAI API can point at localhost:11434/v1.
How do I change where Ollama stores models?
Set the OLLAMA_MODELS environment variable to a folder on a large drive, then restart Ollama. Models can be tens to hundreds of gigabytes, so pointing this at your biggest disk is a common first step.
Can I use Ollama as a drop-in for the OpenAI API?
Yes. Ollama exposes an OpenAI-compatible endpoint at http://localhost:11434/v1. Point the OpenAI client's base_url there with any placeholder API key, and most OpenAI code, plus frameworks like LangChain and LlamaIndex, works unchanged.
Can Ollama do vision, embeddings, and tool calling?
Yes. Vision models such as qwen3-vl, llava, and moondream read images. Embedding models such as nomic-embed-text and embeddinggemma power retrieval and RAG. Many models are tagged tools for function calling, and Ollama supports structured JSON output.
How do I create a custom model in Ollama?
Write a Modelfile with a FROM base model plus a SYSTEM prompt and PARAMETER lines, then run ollama create your-name -f Modelfile. You can also import GGUF or safetensors weights with FROM pointing at the file, and push your model to your namespace.
How do I keep Ollama and its models updated?
Re-run the installer or install script to update Ollama itself, and run ollama pull model-name again to update a model, which downloads only changed layers. Ollama ships updates frequently, so re-verify version-specific details before a high-stakes setup.
Your models. Your machine. Your rules.
Pick your platform, pull one model, and run local AI for any task — free, private, and with no rate limits. Then explore the rest of the Academy.
Browse the DDS Vibe AcademyFree. No paywall. No signup. No certificate. Just the work.
