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.