Meet Ollama: run AI models on your own computer
Learn what Ollama is, how to install it on macOS, Windows, Linux, or Docker, which commands to use day to day, how much hardware you need, and how to safely integrate local models through the API, Python, and web interfaces.
AI$ ollama list▍What if you could chat with an AI model without sending a single line of text to the internet? To summarize an internal document, review a script, or test a chatbot idea, a cloud service isn’t always the right fit. Ollama makes this simple: with one installer and one command, you download a language model and start using it on your own computer.
What Ollama is
Ollama is an open source tool, released under the MIT license, for downloading and running LLMs (Large Language Models, the language models behind chatbots) locally. It gives you two things:
- A simple CLI: Docker-style commands such as
ollama pullandollama runto download, run, and manage models. - A local API: an HTTP server on port
11434that any program on your machine can call, including an endpoint compatible with the OpenAI API format.
Think of it as a “package manager” for models: it handles the download and the use of CPU or GPU, and you just pick the model. The Ollama library includes well-known families such as Llama, Gemma, Mistral, Qwen, DeepSeek, and Phi, each in several sizes. If you want to understand what happens inside a model, see how an LLM works.
Why run locally (and what the limits are)
| Advantages | Limitations |
|---|---|
| Privacy: your text never leaves your machine | Hardware: larger models need a lot of memory (RAM or VRAM) |
| Works offline once the model is downloaded | Capability: models that fit on a laptop are usually less capable than the largest hosted models |
| No per-token cost: you only pay for hardware and power | Maintenance: updating models, freeing disk space, and handling security are on you |
| Free experimentation: switch models, tweak parameters, test prompts | Performance: without a GPU, responses can be slow |
Installation
macOS and Windows
Download the installer from ollama.com and follow the wizard. Ollama keeps running in the background, and the ollama command becomes available in your terminal.
Linux
The official route is an install script:
curl -fsSL https://ollama.com/install.sh | sh
This pattern (curl ... | sh) runs a script from the internet straight into your shell without you seeing its contents. Even from an official source, the safer habit is to download it, read it, and only then run it:
curl -fsSL https://ollama.com/install.sh -o install-ollama.sh
less install-ollama.sh # read what the script does before running it
sh install-ollama.sh
On distributions with systemd, the script also sets up Ollama as a service that starts with the system.
Docker
If you prefer to isolate everything in a container (see what is Docker):
# CPU only
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
# with an NVIDIA GPU (requires the NVIDIA Container Toolkit on the host)
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
# run a model inside the container
docker exec -it ollama ollama run <model>
The ollama volume stores the downloaded models, so they survive when the container is recreated. On a Mac, prefer the native app: Docker on macOS doesn’t give containers access to the Apple Silicon GPU. There is a dedicated image for AMD GPUs; check the official documentation.
Essential commands
| Command | What it does |
|---|---|
ollama pull <model> |
Downloads (or updates) a model from the library |
ollama run <model> |
Opens an interactive chat; downloads the model if needed |
ollama list |
Lists installed models and how much space they use |
ollama ps |
Shows the models loaded in memory and whether they’re on GPU or CPU |
ollama show <model> |
Displays details: parameters, quantization, license |
ollama rm <model> |
Removes a model and frees disk space |
ollama serve |
Starts the server manually (when it isn’t running as an app or service) |
ollama cp <source> <destination> |
Copies a model under another name |
ollama create <name> -f Modelfile |
Creates a custom model from a Modelfile |
Replace <model> with the name shown on the model’s page in the Ollama library; many models have tags that let you pick the size. A typical first session:
ollama pull <model>
ollama run <model> # interactive chat; type /bye to exit
ollama run <model> "Explain what a container is in two sentences."
ollama ps # is the model on the GPU or the CPU?
Hardware: how much machine do I need?
The main rule: the model has to fit in memory. If there’s a GPU with enough VRAM, the model runs there, much faster; if it doesn’t fit, Ollama uses RAM and the CPU, or splits the work between them, and gets slower.
Model size is measured in parameters (the “weights” learned during training): more parameters means more memory and, in general, more quality. Quantization stores each weight with less precision, like saving a photo as a more compressed JPEG: the file shrinks a lot and quality drops only a little. Models in the library usually come quantized already.
For acceleration, Ollama uses NVIDIA GPUs, supported AMD GPUs, and Apple Silicon chips, which share memory between CPU and GPU — which is why Macs with plenty of unified memory handle medium models well.
An approximate guide, just to help you choose:
| Model size | Good for | Suggested machine |
|---|---|---|
| Small | Short summaries, classification, autocomplete, quick tests | A regular laptop, even without a dedicated GPU |
| Medium | General chat, coding help, questions about documents | A GPU with plenty of VRAM or a Mac with plenty of unified memory |
| Large | More complex reasoning, more elaborate answers | A workstation with a high-end GPU or a server |
Start with the smallest model that solves your problem and only move up if the quality isn’t enough.
Customizing with a Modelfile
A Modelfile is a recipe, similar to a Dockerfile, that creates a variation of a model with fixed instructions and parameters:
FROM <model>
# lower = more predictable answers; higher = more creative
PARAMETER temperature 0.3
SYSTEM """
You are an internal support assistant for your-org.
Answer in English, concisely, in at most five sentences.
If you don't know the answer, say you don't know.
"""
ollama create support-assistant -f Modelfile
ollama run support-assistant
There’s no training involved: the model is the same, just with built-in instructions and parameters.
Using the local API
With Ollama running, the API answers at http://localhost:11434. The /api/generate endpoint takes a single prompt:
curl http://localhost:11434/api/generate -d '{
"model": "<model>",
"prompt": "List three best practices for writing Dockerfiles.",
"stream": false
}'
The /api/chat endpoint takes a list of messages, which is useful for keeping the conversation history:
curl http://localhost:11434/api/chat -d '{
"model": "<model>",
"messages": [
{ "role": "system", "content": "Keep your answers short." },
{ "role": "user", "content": "What is a volume in Docker?" }
],
"stream": false
}'
With "stream": false, the answer arrives as a single JSON object (the response field for generate, message.content for chat); without it, the answer arrives in chunks.
There’s also an OpenAI-compatible endpoint, so many libraries and tools work just by changing the base URL to http://localhost:11434/v1:
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"messages": [
{ "role": "user", "content": "Summarize what CI/CD is in one sentence." }
]
}'
The text comes back in choices[0].message.content, just like the original API. If a library requires a key, any placeholder value works, because local Ollama doesn’t check it.
Integrations
- Open WebUI: a ChatGPT-style web interface for your Ollama models. It usually runs with Docker; use the command from the project’s official documentation.
- IDE extensions: extensions such as Continue (VS Code and JetBrains) can use Ollama models for chat and code autocomplete, even offline.
- Python: use the official package (
pip install ollama) or call the HTTP API with any client.
from ollama import chat
response = chat(
model="<model>",
messages=[{"role": "user", "content": "Explain what a pod is in one sentence."}],
)
print(response["message"]["content"])
Security
- By default, Ollama listens only on
localhost(127.0.0.1:11434): only programs on your machine can reach the API. - Setting
OLLAMA_HOSTto0.0.0.0exposes the API to the network. The API doesn’t require authentication by default; anyone who can reach the port can use your resources and download or delete models. Never expose port 11434 to the internet. If you need remote access, put a reverse proxy with authentication and TLS in front of it, or use a VPN. - Models come from third parties: each one has its own license, which may restrict commercial use. Check it with
ollama show <model>and on the model’s page before using it at work. - Models make mistakes: review the answers, especially code and commands, before running anything.
Use cases at work
- Summarize internal documents without sending them to external services — still, follow your company’s data policy.
- Coding help offline, in restricted-network environments or while traveling.
- Classify tickets by category or urgency with a script that calls the local API.
- RAG prototypes: combine Ollama with a search over your documents to answer based on them (see what is RAG).
- Compare open models, such as the Chinese Qwen and DeepSeek families, which we cover in Chinese AI: DeepSeek, Qwen, and Kimi.
Ollama shines for personal use and small teams. To serve many users with high availability and autoscaling, it’s time for an inference server on a cluster — see running LLMs on Kubernetes with vLLM.
Next step: to use Ollama from your own programs, see Local AI with Ollama, Python and Rust and the guides Ollama with Python and Ollama with Rust.
Checklist
- Installed with the official installer, or read the script before running it
- Picked the smallest model that solves my use case
- Confirmed with
ollama pswhether the model is running on the GPU - Kept the API on
localhostor protected by a proxy with authentication - Checked each model’s license before using it at work
- Removed models I no longer use with
ollama rm - Reviewed answers before running suggested code or commands
With Ollama, AI comes to your data — not the other way around.