---
title: "Ollama: Run Open AI Models on Your Own Computer"
author: "Ecem Karaman"
source: "https://aiwithecem.com/guides/ollama"
published: 2026-11-22
tools: ["Multi-Tool"]
topics: ["Setup","Building"]
---

# Ollama: Run Open AI Models on Your Own Computer

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.

> **In this guide**
> 1. [How Ollama works](#how-ollama-works)
> 2. [Cool things you can do](#cool-things-you-can-do)
> 3. [Tips and tricks](#tips-and-tricks)
> 4. [What to watch](#what-to-watch)
> 5. [Start here](#start-here)

## How Ollama works

| Piece | What it does |
|---|---|
| **The app and CLI** | Download, run and manage models: `ollama run`, `ollama pull`, `ollama ps` |
| **The library** | The catalog of models at [ollama.com/library](https://ollama.com/library), each in several sizes |
| **The local server** | Runs in the background at `localhost:11434` and serves an API, including OpenAI- and Anthropic-compatible ones |
| **Cloud models** | Bigger models that run on Ollama's servers, used through the same commands. They need an account. |
| **Modelfile** | A 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:

```text
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](https://docs.ollama.com/gpu) 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):

```text
curl -fsSL https://ollama.com/install.sh | sh
```

2. **Run a small model:** `ollama run gemma4:e2b`, and ask it something you'd normally ask a chatbot.
3. **Check where it runs** with `ollama ps`, and try a larger size if you have room.
4. **Connect one tool:** `ollama launch claude`, or point an app you use at `http://localhost:11434/v1/`.

**Details checked against [Ollama's docs](https://docs.ollama.com) and [GitHub repo](https://github.com/ollama/ollama) on November 22, 2026.**

**Go deeper:** [Ollama quickstart](https://docs.ollama.com/quickstart) · [Context length](https://docs.ollama.com/context-length) · [Context windows, explained](/guides/context-windows) · [Inference engines](/guides/inference-engines)
