Ollama: run AI models on your own computer without the silent traps

Set up Ollama for private local AI, then check the three things that quietly go wrong: a short context window, cloud models that leave your machine, and an open API port.

code · Published 2026-11-11 · Website · Translation: VI

Ollama is a free, open-source app that downloads open-weight language models and runs them on your own computer. You type ollama run and a model name, and you get a chat in the terminal — plus a local API on port 11434 that other tools can talk to as if it were OpenAI. For many people it is the easiest way to try local AI: summarizing private documents, asking questions about code that cannot leave the laptop, or working offline on a train.

Installing it takes minutes. The problems show up later, and they are quiet. A model “forgets” the start of a long file without any error. A model that looks like it is running locally is actually running on someone else’s server. A setting copied from a forum opens the API to the whole network. This note covers the setup briefly and then spends most of its time on those three checks, because they decide whether Ollama is doing what you installed it for.

When Ollama fits, and when it does not

Ollama is a good choice when:

  • The data must stay on your machine — client contracts, unreleased code, health or HR notes — and your policy allows local processing.
  • The job is small and repeated: summarize, classify, extract fields, rewrite, explain a function. Mid-size open models handle these well.
  • You want a free local endpoint for an editor plugin, a script, or a note-taking app that accepts an OpenAI-compatible URL.
  • You are offline or on a metered connection.

It is the wrong tool when:

  • You need the strongest reasoning or coding agent available. Hosted frontier models are still clearly ahead on hard, multi-step work. The local coding models board has the current picks if you want to see how close local gets.
  • Your computer is small. A model has to fit in memory to run at a usable speed. On a laptop without much GPU memory you are limited to small models, which make more mistakes.
  • A team needs one shared server with logins and usage limits. Ollama has no user accounts on its local API; you would need to put something in front of it.

Prefer clicking to typing commands? LM Studio runs the same kind of open models in a desktop window, with the same traps to check. Already holding a GGUF and want the flags on the command? llama.cpp’s server listens on port 9931.

Set it up in five commands

Download the app for macOS, Windows or Linux from the official site, then in a terminal:

ollama pull llama3.2          # download a model (pick one from ollama.com/library)
ollama run llama3.2           # chat with it in the terminal; type /bye to exit
ollama list                   # models on disk, with sizes
ollama ps                     # models loaded right now — check the CONTEXT column
ollama rm llama3.2            # delete a model you no longer use

Choose the model size by your memory, not by the leaderboard. As a rough guide, the download size shown by ollama list should fit in your GPU memory (or system RAM if you have no GPU) with a few gigabytes to spare, because the context window needs room too. If replies crawl at a word every second or two, the model is too big for the machine. Model names and sizes change often; the library page lists the current ones.

ollama ps is the command to remember. It shows what is loaded, how much memory it uses, whether it runs on GPU or CPU, and — most importantly for the next section — how big the context window really is.

Trap 1: the context window is shorter than you think

The context window is how much text the model can see at once: your question, any file you paste, and the conversation so far. Models advertise large windows, but Ollama does not give a model its full window by default. According to Ollama’s FAQ the default is 4,096 tokens — roughly 3,000 English words or a few pages — and its docs say the default rises only on machines with a lot of GPU memory.

When you paste more than fits, nothing warns you. The oldest text is dropped and the model answers from what is left. Ask it to summarize a 20-page contract and you may get a confident summary of the last four pages.

A 20-page contract goes into a model with a 4,096-token window: only the last pages fit, the start is dropped silently, and the summary covers only the end. The fix is to raise num_ctx and confirm it in ollama ps.

ollama show reports the most the model supports; ollama ps shows what it actually got. Only the second number matters.

To raise the window, pick the method that matches how you use Ollama:

  • For everything on this machine: start the server with a larger default, for example OLLAMA_CONTEXT_LENGTH=16384 ollama serve. If Ollama runs as the desktop app or a system service, set the variable the way the Ollama FAQ describes for your OS, then restart it.

  • For one terminal chat: inside ollama run, type /set parameter num_ctx 16384. Type /save my-model-16k afterwards if you want to keep it as a new model name.

  • For tools that use the OpenAI-compatible API: that API has no field for context size, so build a model with the size baked in:

    # Modelfile
    FROM llama3.2
    PARAMETER num_ctx 16384

    Then run ollama create llama3.2-16k -f Modelfile and point your tool at llama3.2-16k.

A bigger window costs memory and speed, so raise it to what your documents need, not to the maximum. Then confirm with ollama ps while the model is loaded. A quick practical test: paste a long file and ask “What is written on the first line?” If the answer is wrong, the start of the file never reached the model.

Trap 2: some model names run in the cloud, not on your computer

Recent versions of Ollama can also run cloud models: larger models hosted on Ollama’s servers, used through the same app and commands after you sign in. They are easy to spot once you know — the model name contains cloud, as in gpt-oss:120b-cloud or a :cloud tag. Ollama says its cloud does not keep your data. Even so, your prompt and any file you paste leave your machine.

That matters if the reason you installed Ollama was “nothing leaves my laptop”. A colleague’s setup guide, an editor integration, or a “try this bigger model” tip can switch you to a cloud model without the experience feeling any different.

Decision path: if the model name contains “cloud”, the prompt is processed on Ollama’s servers; if you pulled it and it is listed by ollama list, it runs locally. For private data, use only local names and do not sign in on that machine.

Cloud models are useful when the data is not sensitive — the point is to choose them on purpose.

For machines that handle private data, a simple rule works: only use models you pulled yourself and can see in ollama list, check the model name in every tool’s settings, and do not sign in to an Ollama account on that machine unless you mean to use the cloud.

Trap 3: the API has no password

Ollama’s local API answers anyone who can reach it — there is no login. By default it only listens on your own computer (127.0.0.1:11434), which is safe. Forum answers sometimes suggest setting OLLAMA_HOST=0.0.0.0 so another device can connect. That opens the API to every device on the network: on café Wi-Fi, or on a cloud server with the port open, strangers can use your models and your hardware.

If you need access from another device, keep Ollama on 127.0.0.1 and connect through something that adds authentication, such as an SSH tunnel or a reverse proxy with a password. Never open port 11434 to the internet.

Connect your editor, scripts and apps

Most tools that accept an “OpenAI-compatible” or “custom” endpoint work with Ollama. Use these settings:

  • Base URL: http://localhost:11434/v1
  • API key: any text (the client requires one; local Ollama ignores it)
  • Model: the exact name from ollama list — or the -16k model you created

A quick test from the terminal before you blame the tool:

curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "llama3.2-16k", "messages": [{"role": "user", "content": "Reply with one word: ready"}]}'

Setup check in order: pull a model that fits your memory, set the context size, confirm it in ollama ps, point the tool at localhost:11434/v1 with a local model name, then run the first-line test on a long file.

If the first-line test fails inside a tool but passes in the terminal, the tool is using a different model name — usually the one without your context setting.

Local models are weaker than the big hosted ones, so give them smaller jobs: one function rather than a whole module, one document section rather than the full report. For deciding which tasks are worth keeping local in a codebase, see local models for private repos.

Common mistakes

  • Judging a model on a long document with the default context. The model is not bad; it never saw the first half. Fix the window, then judge.
  • Picking the biggest model that downloads. If it does not fit in memory it spills to the CPU and becomes too slow to use. A smaller model at full speed beats a large one at a word per second.
  • Assuming “Ollama” means “local”. Check the model name for cloud in every tool you connect.
  • Copying OLLAMA_HOST=0.0.0.0 from a forum on a laptop or a cloud server. Use a tunnel instead.
  • Keeping every model forever. Models take many gigabytes each. ollama list and ollama rm the ones you stopped using.

Bottom line

Ollama is the simplest way to run open models privately and give your other tools a free local endpoint. Install it in minutes, then do three checks before you trust it with real work: raise the context window and confirm it in ollama ps, use only local model names for private data, and keep the API on 127.0.0.1. With those in place, it does what most people install it for — useful AI on data that never leaves the machine.

Share

X Facebook LinkedIn