Skip to content

How-ToGPU

How to Use the LLM Command-Line Tool With Ollama on Your PC

Simon Willison's LLM tool lets you prompt local models from your terminal, pipe files in, save templates and log every answer. Here's how to install it, connect it to Ollama and use it day to day.

By , Systems & Technical Editor

4 min read

How to Use the LLM Command-Line Tool With Ollama on Your PC

LLM is a free command-line tool by Simon Willison that lets you prompt language models from a terminal, pipe files into them, save favourite prompts as templates and keep a record of everything you ask. With the llm-ollama plugin it works with models running locally in Ollama, so your prompts stay on your own PC. This guide covers installing it on Windows or Linux, connecting it to Ollama and the commands worth learning first.

What you need

  • Ollama, installed and running with at least one model downloaded. On Windows, Ollama's README gives the PowerShell command irm https://ollama.com/install.ps1 | iex, or you can download the installer from ollama.com. Linux users can follow our Ollama on Linux guide.

  • Python, because LLM is a Python package. If you'd rather avoid managing Python packages yourself, pipx or uv can install LLM in its own isolated environment.

  • A model that suits your graphics card. Our best local LLMs for 12GB of VRAM guide is a good starting point.

Step 1: Download a model in Ollama

Open a terminal and pull a model. The llm-ollama documentation uses Gemma 3 in its examples:

ollama pull gemma3

Leave Ollama running in the background. By default the plugin looks for it at localhost:11434.

Step 2: Install LLM

The LLM documentation lists four ways to install it. Pick one:

pip install llm
pipx install llm
uv tool install llm
brew install llm

Homebrew is for macOS and Linux. On Windows, pipx or uv is the tidiest choice, because each keeps LLM separate from other Python projects.

Step 3: Add the Ollama plugin

Plugins are installed through LLM itself, which puts them in the same environment:

llm install llm-ollama

Then check which local models LLM can see:

llm ollama models

The plugin discovers every model on your Ollama server automatically and lists its capabilities, such as completion, vision, tools, thinking or embedding.

Step 4: Send your first prompt

Local models are named after their Ollama names with ollama/ in front:

llm -m ollama/gemma3 "Explain what a page file is in two sentences"

For models tagged :latest, the plugin creates a shorter alias, so ollama/gemma3 and ollama/gemma3:latest are the same model. To have a back-and-forth conversation instead of a single prompt, open a chat session:

llm chat -m ollama/gemma3

Type exit or quit to leave. In chat, !multi lets you enter several lines and !edit opens your text editor for a longer prompt.

Step 5: Make your local model the default

Typing -m ollama/gemma3 every time gets old. Set it as the default model:

llm models default ollama/gemma3

Run llm models default on its own to see which model is currently the default.

Step 6: Learn the commands that make LLM useful

  • Pipe a file in with a system prompt. cat myfile.py | llm -s "Explain this code" sends the file as the prompt and your instruction as the system prompt. In PowerShell, Get-Content myfile.py | llm -s "Explain this code" does the same job.

  • Carry on the conversation. llm -c "Now make it shorter" continues your previous exchange and automatically uses the same model.

  • Save a prompt as a template. llm -s "write pytest tests for this code" --save pytest stores it; cat utils.py | llm -t pytest reuses it.

  • Pull out just the code. -x returns only the first fenced code block from a reply, which is handy when you want to send the output straight into a file.

  • Ask for structured data. Ollama's structured outputs work through LLM schemas, for example llm --schema "name, age int, one_sentence_bio" "invent a cool dog".

  • Describe an image. If a model reports the vision capability, attach an image with -a, for example llm -m ollama/llava "Describe this image" -a photo.jpg.

Step 7: Control reasoning models

Some Ollama models "think" before answering, which can make replies slow on a mid-range GPU. The plugin offers two options: -o think false skips the reasoning step entirely, while --hide-reasoning lets the model think but hides the trace from the output.

Step 8: Decide what gets logged

LLM logs every prompt and response to a SQLite database by default, which is useful if you want to look back at an answer later. If you'd rather not keep a record, run llm logs off; llm logs on turns it back on and llm logs status shows the current setting.

Troubleshooting

  • No models appear. Make sure Ollama is running and has at least one model pulled, then run llm ollama models again.

  • Ollama runs on a different port or another PC. Set the OLLAMA_HOST environment variable, for example http://localhost:8080 or the address of a server on your network. Our guide to setting Ollama environment variables on Windows explains where to set them.

  • The plugin vanished after an upgrade. The LLM documentation warns that upgrading with uv, pipx or Homebrew replaces LLM's environment and removes plugins installed with llm install. Run llm install llm-ollama again.

  • Replies are slow or cut short. Try a smaller model or reduce how much text you pipe in; our explainer on context length and VRAM covers why long inputs need more memory.

If you'd like to compare LLM with other terminal tools, see our best command-line tools for local LLMs and our head-to-head of aichat vs LLM.

The bottom line

Install LLM with pipx, uv or pip, add the plugin with llm install llm-ollama, check your models with llm ollama models and set one as the default with llm models default ollama/<model>. From then on you can pipe files in with -s, continue conversations with -c, save prompts as templates with --save and -t, and turn off a reasoning model's thinking with -o think false. Remember to reinstall the plugin after upgrading LLM with uv, pipx or Homebrew, and set OLLAMA_HOST if Ollama isn't on its default port.

Sources

  1. 01LLM documentation, Setup
  2. 02LLM documentation, Usage
  3. 03GitHub, taketwo/llm-ollama (README)
  4. 04GitHub, ollama/ollama (README)

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Stop Your Microphone Volume Changing on Its Own in Windows 11

How-To

How to Stop Your Microphone Volume Changing on Its Own in Windows 11

If your mic level keeps jumping up or down in Windows 11, an app's Automatic Gain Control is the usual culprit. Here's how to set your level in Windows and turn off automatic mic adjustment in Teams, Discord, Zoom and your mic's own software.

Marcus Thorne4 min

Best Free Apps to Control Monitor Brightness in Windows (2026)

Best Picks

Best Free Apps to Control Monitor Brightness in Windows (2026)

Windows' brightness slider often can't control an external monitor. These are the best free apps that can, over DDC/CI: Twinkle Tray, Monitorian and ControlMyMonitor, plus Windows' own settings for laptops and Dell's app for Dell screens, chosen from the developers' official pages.

Hannah Vance5 min

Core Temp vs HWMonitor: Which Free Temperature Monitor Should You Use?

Versus

Core Temp vs HWMonitor: Which Free Temperature Monitor Should You Use?

Core Temp shows per-core CPU temperatures read straight from the processor's thermal sensor; HWMonitor reads the whole PC, from GPU hotspot and fans to voltages, power and drives. Using ALCPU's and CPUID's official pages, we compare what each covers, recent updates and which to use.

Callum Reid4 min