When someone says they're "running AI locally", there's a good chance they mean Ollama. It's a free, MIT-licensed app that downloads open models like Gemma, Qwen, DeepSeek and gpt-oss and runs them on your own machine, with one command to chat and a local API that other apps can use. It also offers larger cloud models for when your laptop isn't enough, and it plugs straight into agents like Claude Code and OpenClaw.

How Ollama works

PieceWhat it does
The app and CLIDownload, run and manage models: ollama run, ollama pull, ollama ps
The libraryThe catalog of models at ollama.com/library, each in several sizes
The local serverRuns in the background at localhost:11434 and serves an API, including OpenAI- and Anthropic-compatible ones
Cloud modelsBigger models that run on Ollama's servers, used through the same commands. They need an account.
ModelfileA small text file that turns a model plus your settings into your own named model

Local means your prompts never leave your machine. The trade-off is that a laptop runs smaller models more slowly than a frontier model in the cloud.

Cool things you can do

1. Chat with a model offline. Run ollama run gemma4 and you're chatting in your terminal. It keeps working on a plane, and nothing you type is sent anywhere.

2. Point Claude Code at a different model. ollama launch claude starts Claude Code connected to Ollama models, local or cloud, through its Anthropic-compatible API. ollama launch openclaw does the same for OpenClaw.

3. Make a reusable custom assistant. Save a Modelfile like this:

PROMPT / COPY-PASTE
FROM gemma4
PARAMETER temperature 0.3
SYSTEM You rewrite messy meeting notes into a short summary with decisions and owners.

Then ollama create notes-cleaner -f Modelfile, and ollama run notes-cleaner is your one-job assistant.

4. Swap it into apps that expect OpenAI. Many tools let you change the "base URL". Set it to http://localhost:11434/v1/ and they talk to your local model instead.

5. Get clean JSON back. Pass a JSON schema in the format field of an API request and the model's answer follows that structure, which helps when extracting fields from receipts, emails or forms.

6. Search your own documents. Ollama makes embeddings too, the building block for asking questions about your own files without uploading them.

Tips and tricks

  • Raise the context window for agents and coding. On machines with under 24 GB of graphics memory, the default is just 4k tokens. Ollama recommends at least 64k for agents, coding tools and web search. Set it in the app's settings or start the server with OLLAMA_CONTEXT_LENGTH=64000 ollama serve.
  • Check it's actually on your GPU. ollama ps shows how much of the model is on the GPU versus the CPU. If a lot of it is on the CPU, pick a smaller size.
  • Start small. Models come in sizes, like gemma4:e2b. A smaller one that runs fast often beats a bigger one that crawls.
  • Keep a model warm or free memory. Models stay loaded for 5 minutes after use. ollama stop <model> unloads one right away.
  • Use cloud for the heavy lifting. When a job needs a bigger model than your hardware can run, a cloud model uses the same commands. Ollama says it doesn't store cloud prompts or train on them.

What to watch

  • Hardware decides quality. What feels fast depends on your graphics memory. Check the hardware support page before buying anything for it.
  • Local and cloud look alike. Cloud models run on Ollama's servers. To guarantee everything stays on your machine, set "disable_ollama_cloud": true in ~/.ollama/server.json.
  • Think before exposing the server. Ollama only listens on your own machine by default. Changing OLLAMA_HOST to share it on a network gives anyone who can reach it access to your models.
  • Open models aren't frontier models. For hard reasoning or long coding sessions, a small local model will make more mistakes. Test it on your real task before you rely on it.

Start here

  1. Install it on macOS or Linux (Windows has a PowerShell installer and a download):
PROMPT / COPY-PASTE
curl -fsSL https://ollama.com/install.sh | sh
  1. Run a small model: ollama run gemma4:e2b, and ask it something you'd normally ask a chatbot.
  2. Check where it runs with ollama ps, and try a larger size if you have room.
  3. Connect one tool: ollama launch claude, or point an app you use at http://localhost:11434/v1/.

Go deeper: Ollama quickstart · Context length · Context windows, explained · Inference engines