LLM — A CLI Utility and Python Library for Large Language Models
by Simon Willison
Talk to every major model — and dozens of local ones — from one terminal command, with every prompt logged to SQLite.
Overview
llm is a single command-line entry point to effectively every large language model, plus a Python library exposing the same abstractions, written and maintained by Simon Willison, co-creator of Django and creator of Datasette. The Apache-2.0 repository carries 12.4k GitHub stars and the documentation tracks a fast release cadence: version 0.32a0 shipped on 29 April 2026 as a large backwards-compatible refactor, following an August 2026 release that added reasoning traces, OpenAI Responses API support, server-side tools and smarter logging. The docs are organised as setup, CLI usage, model configuration, templates and fragments, schemas, tools, embeddings, plugins, the Python API, SQLite logging and a complete CLI reference. What makes them worth reading end to end rather than skimming is the design underneath. Every prompt and response is logged automatically to a local SQLite database, so llm logs gives a queryable history of every experiment you have ever run. llm embed and llm similar turn embeddings into a two-command similarity search over your own files. The --schema option extracts structured JSON from text and images against a schema you define, and --tool lets a model call Python functions you supply or install from plugins. The plugin system spans model providers, embedding models, tools, template and fragment loaders and extra CLI commands, which is how Ollama, LM Studio and any OpenAI-compatible endpoint plug in. Install with pip install llm, brew install llm, pipx install llm or uv tool install llm.
At a Glance
- Topic
- Frameworks
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- ~10 minutes to your first prompt; ~2-3 hours to work through the full documentation
- Provider
- Simon Willison
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Run and compare the same prompt across OpenAI, Anthropic, Gemini and local Ollama models
- ✓Query a full SQLite log of every prompt and response you have ever sent
- ✓Extract structured JSON from text and images with --schema instead of hand-written parsers
- ✓Give models real tool access from your own Python functions or installable plugins
- ✓Build embedding collections and run similarity search using llm embed and llm similar
- ✓Write a plugin that adds a model provider, tool, template loader or new CLI command
- ✓Compose reusable prompts with templates and fragments rather than pasting context by hand
Highlights
- •One interface over dozens of providers — swapping models is a -m flag, not a code change
- •Automatic SQLite logging makes model comparison reproducible, where most SDK workflows lose the history
- •Unix-native: pipes, shell scripts and cron compose with it instead of fighting it
- •12.4k GitHub stars, Apache-2.0, and a maintainer who ships releases most months and writes each one up
- •Repeatedly discussed on Hacker News, including the Show HN thread for tool support in version 0.26
Who It’s For
Best For
- ✓Engineers evaluating models who want reproducible, logged, side-by-side comparisons
- ✓Anyone scripting LLM calls into shell pipelines or scheduled jobs rather than a web app
- ✓Developers who want hosted-API and local-model access behind one identical interface
- ✓Data practitioners doing bulk structured extraction from documents and images
Prerequisites
- •Comfort with a Unix shell, pipes and installing Python CLI tools
- •An API key for at least one hosted provider, or Ollama installed for local models
- •Basic SQL if you want to query the prompt log directly
FAQ
What is LLM — A CLI Utility and Python Library for Large Language Models?
The official documentation for llm, Simon Willison's command-line tool and Python library for OpenAI, Anthropic, Gemini, Qwen, Gemma, Kimi, DeepSeek, Mistral and local models via Ollama. It covers prompting, templates and fragments, embeddings, JSON schema extraction, tool calling and the plugin system. Work through it and you can script model comparisons, build embedding search and give models tools without writing a single SDK integration.
Is LLM — A CLI Utility and Python Library for Large Language Models free?
LLM — A CLI Utility and Python Library for Large Language Models is free to access.
What level is LLM — A CLI Utility and Python Library for Large Language Models for?
LLM — A CLI Utility and Python Library for Large Language Models is aimed at a intermediate audience. Recommended background: Comfort with a Unix shell, pipes and installing Python CLI tools, An API key for at least one hosted provider, or Ollama installed for local models, Basic SQL if you want to query the prompt log directly.
How long does LLM — A CLI Utility and Python Library for Large Language Models take?
Expect roughly ~10 minutes to your first prompt; ~2-3 hours to work through the full documentation. Most learners work through it at their own pace.
What will I learn from LLM — A CLI Utility and Python Library for Large Language Models?
You'll learn: Run and compare the same prompt across OpenAI, Anthropic, Gemini and local Ollama models; Query a full SQLite log of every prompt and response you have ever sent; Extract structured JSON from text and images with --schema instead of hand-written parsers; Give models real tool access from your own Python functions or installable plugins; Build embedding collections and run similarity search using llm embed and llm similar; Write a plugin that adds a model provider, tool, template loader or new CLI command; Compose reusable prompts with templates and fragments rather than pasting context by hand.
Topics
Sources
This page was written from 3 sources, 2 on domains other than llm.datasette.io.