Ollama is a free, open-source tool for running open LLMs (large language models) on your own computer. It installs on Windows, macOS, and Linux, and a single line, ollama run model-name, takes you from downloading a model to chatting with it. While it runs, an API server listens on localhost:11434, so your own apps and tools such as Claude Code can call it too. Besides models that run on your machine, it now also runs cloud models, whose names end in :cloud, with the same commands.

This guide sticks to how to use Ollama itself, checked against the original text of the official GitHub repo (including the source code), the official docs, and the pricing page (as of November 12, 2026). For local LLMs in general, see how to run a local LLM; for which model to pick, our best local LLM models comparison; for working out the VRAM you need, the hardware requirements article; and for wiring a model into your editor, the Ollama + Cline article.

LOCAL + CLOUD

Same commands, on your machine or in the cloud

— Four entry points: the app, the CLI, the API, and launching integrations

$ ollama run gemma4 # run on your own PC
$ ollama run gemma4:cloud # run on Ollama's servers
$ ollama launch claude # Claude Code on Ollama models

🖱️ Chat in the app

⌨️ Commands (CLI)

🔌 Local API

🚀 Launch integrations

1. What is Ollama? Two ways to run models: local and cloud

Ollama is a free, open-source tool for running open models (Gemma, Qwen, gpt-oss and others) easily on your own PC. It handles the tedious parts in the background (downloading models, dealing with quantization formats, configuring GPU use), so all you do is "name a model and run it". Inference is built on llama.cpp, and on Apple silicon Macs some models also come in versions that run on Apple's MLX.

💡 In a nutshell: Ollama is "Docker for LLMs". Fetch a model with ollama pull, chat with ollama run. It also starts a local API server, so your own apps, chat interfaces and coding agents can call it.

There are two ways to run a model, and which one you choose completely changes the PC you need and what you pay.

Local

ollama run gemma4

  • Downloads the model to your PC and runs it there
  • Unlimited use at no charge (apart from electricity)
  • Speed depends on your GPU and VRAM
  • Your input never leaves your PC

Cloud

ollama run gemma4:cloud

  • Runs on Ollama's servers (no download)
  • Pay per token, or use the credits in a monthly plan
  • Large models are fast even on a PC without a GPU
  • Your input is processed on Ollama's servers

A similar tool is LM Studio. Roughly: Ollama = built around commands and the API, suited to developers, automation and connecting agents; LM Studio = built around a GUI, for people who want to go from finding a model to chatting without leaving the window. Both are free. The differences between local and cloud themselves (cost, performance, privacy) are covered in our local vs. cloud LLM comparison.

2. How to install Ollama (Windows / macOS / Linux / Docker)

The official download page and the README on GitHub offer two routes for each OS: a one-liner you paste into a terminal, or a manual installer. Both give the same result.

OS One-line install (verbatim from the official page) Requirements
Windows In PowerShell: irm https://ollama.com/install.ps1 | iex Windows 10 22H2 or later (Home / Pro), no administrator rights needed, at least 4 GB free for the program alone
macOS curl -fsSL https://ollama.com/install.sh | sh macOS 14 Sonoma or later, Apple M-series uses CPU and GPU, Intel Macs CPU only
Linux curl -fsSL https://ollama.com/install.sh | sh Re-run the same line to update, extra package for AMD GPUs

Windows

If you'd rather not use a command, get OllamaSetup.exe from the download page and run it. According to the official Windows page, it installs into your home folder by default, and models can take tens to hundreds of GB on top. If drive C: is short on space, change the install location with OllamaSetup.exe /DIR="d:\some\location" and the model location with the OLLAMA_MODELS environment variable (section 9). After installation Ollama runs in the background, and the ollama command works in both cmd and PowerShell.

macOS

To install manually, open Ollama.dmg and drag the app into the Applications folder. On first launch, if the ollama command isn't on your PATH, the app asks permission to create a link in /usr/local/bin (official macOS page).

Linux

Manual installation without the script and the extra package for AMD GPUs are described on the official Linux page. Linux has no app like Windows and macOS do; you use it through commands and the API.

Docker

The official image ollama/ollama is on Docker Hub. A minimal CPU-only start looks like this. For NVIDIA GPUs, install the NVIDIA Container Toolkit and add --gpus=all; for AMD GPUs, use the ollama/ollama:rocm image (official Docker page). Docker Desktop on macOS can't use the GPU (official FAQ), so on a Mac installing the app directly is faster.

docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
docker exec -it ollama ollama run gemma4:e2b

🔌 Checking it works, and updating: after installing, open a new terminal and type ollama -v. If a version number appears, you're set. Typing ollama with no arguments opens a menu where you choose to run a model or connect an integration such as Claude Code. Updates download automatically on Windows and macOS; click the icon in the taskbar or menu bar and choose "Restart to update" to apply them. On Linux, re-run the install line (official FAQ).

3. Will it run fast on your GPU? (supported GPUs at a glance)

If Ollama can't use your GPU it falls back to the CPU, so you won't see an error, but it becomes several times slower. Before installing, check whether your GPU is listed on the official Hardware support page. Here are the key points.

GPU / platform Conditions for running on the GPU If yours isn't listed
✓ NVIDIA Compute Capability 5.0 or higher (GTX 750 and later), driver 550 or newer (570 or newer for the 5.0–6.2 generations), on Windows driver 551.61 or newer Older cards aren't covered by the official builds (the official development docs explain building locally for older GPUs)
✓ AMD Radeon (Linux) ROCm v7 driver, RX 9070 and 9060 series, RX 7000 series, RX 6800 to 6950 XT, Ryzen AI Max and others Run it via Vulkan, or use HSA_OVERRIDE_GFX_VERSION to run it as a nearby generation
△ AMD Radeon (Windows) ROCm v7 / HIP7 support covers the RX 7600 to 7900 XTX and the Radeon PRO W7000 series The RX 6000 series and others may run via Vulkan (on by default)
△ Intel and other GPUs Runs via Vulkan (bundled with most drivers on Windows, often needs extra components on Linux) If it's unstable, turn Vulkan off with OLLAMA_VULKAN=0
✓ Mac (Apple M-series) Uses the GPU via Metal, and unified memory serves as VRAM —
✕ Mac (Intel), Docker on macOS CPU only Use a smaller model, or a cloud model

To see whether a model actually landed on the GPU, run ollama ps while it's loaded. If the PROCESSOR column says 100% GPU, it's entirely on the GPU; a split such as 48%/52% CPU/GPU means it overflowed VRAM (official FAQ). What to dial down when it's split is covered in the table in section 9. VRAM estimates per GPU are in our hardware requirements article.

4. Ollama command list

This table covers the commands in the official CLI reference and those defined in the source code (cmd/cmd.go). Day to day, you'll mostly use the first six.

Command What it does Example
ollama Opens a menu where you choose to run a model or connect an integration ollama
ollama run MODEL [PROMPT] Starts a model and chats with it (downloads it first if needed; with a PROMPT it answers once and exits) ollama run gemma4
ollama pull MODEL Only downloads a model ollama pull gemma4:e2b
ollama list Lists downloaded models with their sizes (alias: ls) ollama ls
ollama ps Lists models currently loaded in memory (the PROCESSOR column shows GPU or CPU, the CONTEXT column the context length in use) ollama ps
ollama launch [integration] Starts Claude Code, Codex, OpenCode and others already connected to Ollama models (--model picks the model, --config only configures) ollama launch claude
ollama stop MODEL Unloads a running model from memory ollama stop gemma4
ollama rm MODEL Deletes a model to free disk space (several at once allowed) ollama rm gemma4:e2b
ollama show MODEL Shows model information (--modelfile, --parameters and --license show the settings and license) ollama show --modelfile gemma4
ollama create MODEL Builds your own model from a Modelfile ollama create my-assistant -f Modelfile
ollama cp SOURCE DESTINATION Copies a model under a new name ollama cp gemma4 my-gemma
ollama push MODEL Uploads your model to a registry (ollama.com) ollama push your-name/my-assistant
ollama serve Starts the API server (alias: start; on Windows and macOS the background app does this for you) ollama serve
ollama signin / signout Signs in to and out of ollama.com (for cloud models) ollama signin

ollama run has some handy options. With --verbose, it prints the elapsed time and tokens per second (eval rate) after each answer, so you can compare speed in numbers when you switch models or tags. --think=false stops models that show their reasoning from doing so, --format json makes the answer come back as JSON, and --keepalive 30m changes how long the model stays in memory. For models that can read images, just include the file path in your prompt, as in ollama run gemma4 "What's in this image? ./photo.png".

Inside a chat (after the >>> prompt) you can use special commands that start with /. /bye exits, /? lists them all, /clear wipes the conversation context, and /set parameter num_ctx 8192 changes the context length on the spot. To enter several lines at once, wrap them in """.

5. Getting models and reading tags

You specify a model by name + tag. Leave out the tag and latest is used, but which size latest points to differs from model to model. Install without checking and you may get a much bigger version than you expected. Using the official gemma4 tag list as an example, here is how to read tags (as displayed on November 12, 2026).

Tag Meaning Size for gemma4
gemma4 (= :latest) The version you get without a tag, for gemma4 the same as e4b 6.6–9.5 GB
:e2b :e4b :12b :26b :31b Versions with different parameter counts (generally, bigger number = smarter and heavier) 4.6–7.5 GB / 6.6–9.5 GB / 7.7–8.0 GB / 16–19 GB / 19–20 GB
-q4_K_M -q8_0 -bf16 Quantization levels (smaller number = lighter, with slightly lower accuracy) For e4b: 6.6 GB / 9.0 GB / 16 GB
-qat Trained with quantization in mind (limits the quality loss at the same 4 bits) For e4b: 6.1 GB
-mlx -nvfp4 -mxfp8 Formats for specific runtimes (mlx for Apple silicon's MLX, nvfp4 and mxfp8 are low-bit formats for newer GPUs) For e4b: 9.5 GB / 9.5 GB / 12 GB
:cloud -cloud Runs on Ollama's servers (nothing is downloaded) Uses no local storage

The sizes come as ranges because one tag contains several formats, and the one that suits your machine is chosen. For gemma4's latest, the lower bound of 6.6 GB matches e4b-it-q4_K_M and the upper bound of 9.5 GB matches e4b-mlx. When in doubt, pick a tag without a suffix (such as gemma4:e4b) and Ollama chooses the right format for your machine. Quantization formats themselves (how to read GGUF's Q4_K_M and so on) are covered in our quantization formats article.

# Around 8 GB VRAM: start with the small version (4.6–7.5 GB)
ollama run gemma4:e2b
# 12–16 GB VRAM: the mid-size version (7.7–8.0 GB)
ollama run gemma4:12b
# 24 GB VRAM or more: the large version (19–20 GB)
ollama run gemma4:31b

The VRAM figures are a rough guide: the model size plus headroom for the conversation (the context). The official quickstart likewise recommends "8 GB of VRAM (or unified memory on a Mac)" for gemma4:e2b (about 7.2 GB in the format installed by default). Once installed, ollama show gemma4 shows the parameter count, quantization and context length.

💡 Which model should you pick? The examples above only illustrate how to read tags. Which model families are strongest for each use (general / coding / your language) is in our best local LLM models comparison, and choosing a model for writing code in your editor is covered in the Ollama + Cline article.

6. Using a GUI (the Ollama app, Open WebUI and more)

If you'd rather avoid the terminal, start by opening Ollama's own app. The Windows and macOS versions include a window where you pick a model and chat (official blog post "Ollama's new app"). Linux has no app, so use one of the other interfaces below.

The Ollama app (Windows, macOS)

Includes model selection, downloading and chat. You can drag in text or PDF files for it to read, and pass images to models that can read them. A slider in the settings changes the context length. On macOS, "Apps" lets you connect Ollama models to the Claude and ChatGPT desktop apps.

Open WebUI

The go-to browser-based, ChatGPT-style interface you connect to your local Ollama. It supports chat history, switching models and multiple users, which suits sharing one Ollama install across a household or team.

Want a GUI-only setup from the start? LM Studio

A separate app from Ollama that covers model search, download and chat in one window. It's a good entry point for people who don't write code, and on Apple silicon it can also handle models in MLX format.

7. Cloud models and pricing

When your own GPU can't run a large model, you can use cloud models that run on Ollama's servers, with the same workflow. Sign in to ollama.com with ollama signin, then give a name ending in :cloud, such as ollama run gemma4:cloud. No download is needed (official Cloud page). The plans are as follows (pricing page, as of November 12, 2026).

Plan Monthly price Included usage Concurrent requests
Pay as you go $0 None (pay per token for what you use) 3
Pro $20 ($200 billed yearly) $60 of credits every month 3
Max $100 $300 of credits every month 10
Team (early access) $500 $1,000 every month, shared across the team 10

Usage is counted at each model's price per million tokens. The cloud version of gemma4, for example, costs $0.14 for input and $0.40 for output. Using 1 million input tokens and 200,000 output tokens comes to 0.14 + 0.40 × 0.2 = about $0.22. At that ratio, Pro's $60 a month covers about 270 such rounds (60 ÷ 0.22). Included usage doesn't roll over to the next month. Models running on your own machine are unlimited and free on every plan.

🔒 How your data is handled: according to the official FAQ, Ollama doesn't see your prompts or data when you run locally. For cloud models, it says it processes inputs and answers to provide the service but doesn't store or log that content, and never trains on it. According to the pricing page, cloud models are hosted mainly in the United States and may be routed to Europe when demand is high. If you want no cloud use at all, set the environment variable OLLAMA_NO_CLOUD=1, or put "disable_ollama_cloud": true in ~/.ollama/server.json, and restart. If the log shows Ollama cloud disabled: true, it's in effect.

8. Using the API (OpenAI- and Anthropic-compatible)

Ollama's real strength is its local API. By default the server listens on 127.0.0.1:11434; send requests there and your apps, scripts and tools can use a local LLM. There are three request formats.

Ollama API

POST localhost:11434
  /api/chat
  /api/generate

Ollama's own format. It accepts Ollama-specific options such as keep_alive and options.num_ctx.

OpenAI-compatible

POST localhost:11434
  /v1/chat/completions
  /v1/responses

Reuse code written for OpenAI by changing only the endpoint.

Anthropic-compatible

POST localhost:11434
  /v1/messages

Connect tools built for Anthropic's API, such as Claude Code.

/api/chat (send the conversation history)

curl http://localhost:11434/api/chat -d '{
  "model": "gemma4",
  "messages": [{
    "role": "user",
    "content": "Why is the sky blue?"
  }],
  "stream": false
}'

The answer is in message.content. Drop "stream": false and the answer arrives bit by bit as lines of JSON (streaming is the default). For a single answer, you can also send a "prompt" to /api/generate. The example above is written for macOS and Linux shells; Windows PowerShell handles quotes differently, so use this form from the official Windows page (only the model name changed).

(Invoke-WebRequest -method POST -Body '{"model":"gemma4", "prompt":"Why is the sky blue?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json

OpenAI-compatible (/v1)

With the official OpenAI library, pointing base_url at Ollama is all it takes. According to the official docs, on a local server the API key is "required but ignored", so any string will do.

from openai import OpenAI

client = OpenAI(
    base_url='http://localhost:11434/v1/',
    api_key='ollama',  # required but ignored
)

chat_completion = client.chat.completions.create(
    messages=[{'role': 'user', 'content': 'Say this is a test'}],
    model='gemma4',
)
print(chat_completion.choices[0].message.content)

Anthropic-compatible (connecting Claude Code)

The official Anthropic compatibility page has you set these two environment variables for tools built around Anthropic's API. Even without setting them yourself, ollama launch claude starts Claude Code already connected.

export ANTHROPIC_AUTH_TOKEN=ollama  # required but ignored
export ANTHROPIC_BASE_URL=http://localhost:11434

Both compatibility layers support only part of the original APIs. The Responses format, for example, is stateless, so you have to send the conversation history every time. When you use a local model with a coding agent, the context length in the next section is the key.

🔌 A stand-in or fallback for the cloud: many libraries and tools support the OpenAI or Anthropic API. Point them at Ollama and you get a setup that uses local models instead of the cloud, which also works as a fallback when a cloud service goes down. There are also official libraries for Python and JavaScript (pip install ollama / npm i ollama).

9. Customizing (Modelfile, environment variables, memory tuning)

Modelfile: build your own model

A Modelfile is a config file much like a Dockerfile. Start from a base model (FROM, required), add parameters (PARAMETER) and a system prompt (SYSTEM), and you get "your own model" that always behaves the same way. A minimal example:

FROM gemma4
PARAMETER temperature 0.7
PARAMETER num_ctx 16384
SYSTEM """You are a concise assistant. Lead with the key point and keep answers short."""

Save it as a file named Modelfile and run the following in the same folder. Putting num_ctx in the Modelfile extends the context length for this model only, without changing the server-wide default.

ollama create my-assistant -f Modelfile
ollama run my-assistant

ollama show --modelfile gemma4 shows the Modelfile behind an existing model. Copying and editing it is the quickest way in.

Key environment variables

You control the server's behavior with environment variables. ollama serve --help prints the full list. Here are the most common ones, with the defaults written in the source code (envconfig/config.go) and the official FAQ.

Variable What it changes Default
OLLAMA_HOST The address and port the server listens on (with 0.0.0.0:11434, other devices on your LAN can use it) 127.0.0.1:11434
OLLAMA_MODELS Where models are stored (useful for moving them to a larger drive) macOS ~/.ollama/models, Windows C:\Users\%username%\.ollama\models, Linux /usr/share/ollama/.ollama/models
OLLAMA_CONTEXT_LENGTH The default context length Depends on VRAM (under 24 GiB: 4k / 24–48 GiB: 32k / 48 GiB or more: 256k)
OLLAMA_KEEP_ALIVE How long a model stays in memory after last use (-1 keeps it loaded, 0 unloads it immediately) 5m (5 minutes)
OLLAMA_NUM_PARALLEL How many requests one model handles at the same time 1
OLLAMA_MAX_LOADED_MODELS How many models can be loaded in memory at once 3 × the number of GPUs (3 with CPU only)
OLLAMA_MAX_QUEUE The maximum number of requests queued when busy (beyond it the server returns 503) 512
OLLAMA_FLASH_ATTENTION Forces Flash Attention on (1) or off (0) Used automatically where supported
OLLAMA_KV_CACHE_TYPE The precision of the memory that holds the conversation (the K/V cache); q8_0 uses about half, q4_0 about a quarter f16
OLLAMA_ORIGINS Origins allowed to access it from a browser (comma-separated; for extensions, chrome-extension://* and similar) 127.0.0.1 and 0.0.0.0
OLLAMA_NO_CLOUD Setting it to 1 turns off cloud features (remote inference and web search) for local-only use Off

How you set them depends on the OS (official FAQ). On Windows, quit Ollama from the taskbar, add a user variable in the environment variables settings, and restart Ollama from the Start menu. On macOS, set it with something like launchctl setenv OLLAMA_HOST "0.0.0.0:11434" and restart the app. On Linux (running under systemd), do this:

systemctl edit ollama.service
# under [Service], add one line per variable
# Environment="OLLAMA_HOST=0.0.0.0:11434"
systemctl daemon-reload
systemctl restart ollama

Tuning for low memory or long context

With less than 24 GiB of VRAM, the default context length is only 4k (about 4,000 tokens). The official Context length page recommends at least 64,000 tokens for web search, agents and coding tools. When it's too short, the model silently forgets earlier content, so this table lists the setting for each goal, letting you work back from the symptom.

What you want Setting What goes up instead
Long context for a coding agent OLLAMA_CONTEXT_LENGTH=64000 ollama serve, or the slider in the app's settings VRAM use; if it overflows, work shifts to the CPU and slows down
Longer context that still fits in VRAM OLLAMA_KV_CACHE_TYPE=q8_0 (the K/V cache takes about half of f16) A slight loss of precision; with q4_0 it's more noticeable at long context
Serving several people or tools at once OLLAMA_NUM_PARALLEL=4 Memory needed grows to parallel requests × context length (2k with 4 in parallel needs 8k)
No more waiting for the model to load each time OLLAMA_KEEP_ALIVE=-1 VRAM stays occupied while idle (unload with ollama stop)
PROCESSOR is split CPU/GPU and slow A smaller tag (e.g. :12b→:e4b) or a shorter context length Answer quality, or how much it can remember

After changing settings, check with ollama ps that the CONTEXT column shows the length you wanted and PROCESSOR still says 100% GPU. How context length translates into memory is worked out in our hardware requirements article, and the symptoms of an agent breaking when it runs out of context are covered in the Ollama + Cline article.

10. Troubleshooting

Common sticking points and the fixes given in the official FAQ and Troubleshooting page.

Slow or freezing

If the PROCESSOR column in ollama ps isn't 100% GPU, the model doesn't fit in VRAM. Go down a tag size or shorten the context, and compare speed with --verbose.

GPU no longer used after sleep (Linux)

An NVIDIA driver bug can make it fall back to the CPU. The workaround on the official Hardware support page is to reload the driver with sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm.

The API won't connect, or returns 503

Check that the server (the app or ollama serve) is running and that nothing else is using port 11434. To connect from another machine, set OLLAMA_HOST to 0.0.0.0. A 503 means the queue overflowed, so revisit OLLAMA_MAX_QUEUE.

Downloads fail on a company network

Set your proxy with HTTPS_PROXY. The official docs warn against setting HTTP_PROXY (model pulls use HTTPS only, and it can interrupt client connections).

Where the logs are

On Windows, server.log in %LOCALAPPDATA%\Ollama; on macOS, ~/.ollama/logs/server.log; on Linux, journalctl -u ollama; in Docker, docker logs.

Stop it starting at login

On Windows, disable ollama under "Startup apps" in Task Manager; on macOS, turn off Ollama under "Login Items" in Settings. The setting survives updates.

Summary

Ollama runs open models on your own machine or in the cloud with the same workflow. Four takeaways:

  • Check your GPU before installing: NVIDIA needs Compute Capability 5.0 or higher, AMD the ROCm v7 list or Vulkan, Macs an Apple M-series chip. Once running, confirm 100% GPU in ollama ps.
  • Read the tag before you pick: what latest contains differs by model. Look at the size number (e2b, 12b, 31b), and when in doubt choose a tag without a suffix.
  • Set the context length yourself: the default under 24 GiB of VRAM is 4k. At least 64k is recommended for agents; win back memory by quantizing the K/V cache.
  • Connect tools with the API and launch: the OpenAI- and Anthropic-compatible APIs and ollama launch let your own apps and Claude Code use it. Run heavy models with :cloud.

Start by opening the app or typing ollama run gemma4:e2b. The best way to learn is to keep it running while you explore the differences from the cloud and how to choose a model. If you want to go further and wire a model into your editor to write code, coding with a local LLM covers the Cline and Continue setup.

FAQ

Q. Is Ollama free? Can I use it commercially?

A. Ollama itself is free and open source, and models running on your machine cost nothing however much you use them. However, each model you run has its own license, and whether commercial use is allowed depends on the model (check with ollama show --license model-name; see the license section of our model comparison for details). Cloud models are charged as described in section 7.

Q. Ollama or LM Studio: which is better?

A. For commands, APIs, automation and connecting coding agents, Ollama; to go from finding a model to chatting entirely in a GUI, LM Studio. Ollama also has a chat app, so you can install Ollama first and try LM Studio if it isn't enough.

Q. Is my data sent anywhere?

A. As long as you run a model on your own machine, processing stays on your PC; the official FAQ states that Ollama doesn't see your prompts or data when you run locally. If you choose a model with :cloud, your input is processed on Ollama's servers (Ollama says it neither stores it nor trains on it). To stay local only, set OLLAMA_NO_CLOUD=1.

Q. How do I update or uninstall Ollama?

A. On Windows and macOS, updates download automatically and are applied via "Restart to update" on the icon. On Linux, re-run the install line. To uninstall, use the app list in Settings on Windows; on macOS, delete the items listed on the official macOS page. Models stay in the .ollama folder, so delete it too if you no longer need them (and the folder you set with OLLAMA_MODELS, if you moved them).

Q. Can I run Claude Code or Codex on Ollama models?

A. Yes. ollama launch claude (or ollama launch codex for Codex) starts them already connected to Ollama models. With local models, the official docs recommend setting the context length to at least 64,000 tokens.

Q. What kind of PC do I need?

A. The official quickstart recommends 8 GB of VRAM, or similar unified memory on a Mac, for the smallest model, gemma4:e2b (about 7.2 GB in the default format). With less VRAM it still runs using system RAM, but more slowly. For larger models, see our hardware requirements article. On a PC with a weak GPU, cloud models are another option.