The life agentic

Local models and Ollama

If you want to run models on your own machine instead of depending on GitHub, Claude, or a direct API provider, Ollama is the main route worth learning early.

This is not the simplest default path for most students. It becomes attractive when local or offline use, privacy, open-weight experimentation, or avoiding per-prompt API billing matters more than using the strongest hosted model. For the broader picture of why privacy and data exposure matter at all, see Problematic cases of using AI.

Intended learning outcomes covered on this page

After working through this page, students should be better able to:

When this route makes sense

When not to start here

If that sounds like you, start with Model access, GitHub Copilot CLI, or Claude Code instead.

Realistic expectations

Local does not automatically mean better. The tradeoffs are simply different:

Ollama also offers cloud options, but this page focuses on the local-first workflow.

A basic Ollama workflow

  1. Install Ollama from the official download page.
  2. Pull a model.
  3. Make sure it runs locally.

For example:

ollama pull gemma3
ollama list
ollama run gemma3

If one model feels too slow, switch to a smaller one before you keep tuning settings.

On most systems, Ollama exposes a local server that tools can connect to.

Use it with llm

The simplest local path for llm is the llm-ollama plugin:

llm install llm-ollama
llm ollama models
llm -m gemma3 "Explain what this repository is about"

By default, llm-ollama talks to a local Ollama server at localhost:11434. If your server is elsewhere, set OLLAMA_HOST.

Use it with OpenCode

The local OpenCode route is:

  1. Make sure Ollama is running and has at least one model pulled.
  2. Start opencode.
  3. Run /connect.
  4. Choose Ollama.
  5. Confirm the local server address if OpenCode asks for it.
  6. Run /models and select a model.

If tool-calling does not work well, OpenCode recommends increasing num_ctx, starting around 16k to 32k.

Hardware and workflow caveats

This is a good route for learning and experimentation, but it is not a promise that your laptop will handle every model comfortably.

Where this fits in this course

Good habits

Short version

  1. Install Ollama.
  2. Pull one model and make sure ollama run ... works.
  3. Connect it to llm or OpenCode.
  4. Use local models when privacy, offline use, or open-weight experimentation matters.
  5. Prefer hosted tools when you want the easiest or strongest repository workflow.

Next step