Model or dataset
simonw/llm avatar
simonw/llm

simonw/llm: A CLI Tool and Python Library for Accessing Large Language Models

Access large language models from the command-line

12,573 stars1,009 forksPythonApache-2.0

At a glance

What is it?
llm is a command-line tool and Python library by Simon Willison that lets engineers send prompts to OpenAI, Anthropic, Google Gemini, local Ollama models and dozens of other providers from a single terminal interface. Every prompt and response is stored automatically in SQLite, and a plugin system extends the tool to cover new models without changes to the core package.
Who is it for?
Engineers who want to query multiple LLM providers from the terminal without writing API client code will find llm practical and direct. The tool is less suitable for production systems that need fine-grained request control, retry logic or structured error handling: llm is a personal productivity and scripting tool, not a library designed around production reliability guarantees.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 8 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What llm Solves and Who Uses It

Engineers who work across multiple LLM providers face a recurring problem: each provider has its own API client, its own key management approach and its own command syntax. Switching between providers for comparison, chaining a prompt result into a shell pipeline, or logging conversations for later review all require glue code when done directly with provider SDKs. llm provides a single command-line interface and Python library that abstracts over all of these providers.

The tool is positioned for a specific kind of user: engineers, researchers and technically proficient individuals who work at the command line and want to query language models the same way they query databases or files. The README describes the tool as working with OpenAI, Anthropic's Claude, Google's Gemini, Qwen, Gemma, Kimi, DeepSeek, Mistral and dozens of others. The project is maintained by Simon Willison, the co-creator of Django and the author of the Datasette project. The repository is at version 0.36, released on 2026-09-22, with two additional releases in September 2026 (0.35 and 0.34), indicating a fast-moving development pace.

The core use cases are: running a one-shot prompt from the command line, starting an interactive chat session with a model, piping text through a model as a transformation step in a shell pipeline, generating embeddings for semantic search, extracting structured data from unstructured text, and granting models access to tools that can execute on the local machine.

Installation: Four Supported Methods

The README documents four installation methods. Using pip:

bash
pip install llm

Using Homebrew (with a note in the documentation that there is a warning to check before using this path):

bash
brew install llm

Using pipx for an isolated installation that does not affect the system Python environment:

bash
pipx install llm

Using uv as a tool:

bash
uv tool install llm

The README also shows that uvx can run llm against an OpenAI-compatible endpoint without installing llm first, using a one-off command. The pyproject.toml specifies that llm requires Python 3.10 or newer and lists dependencies including click, httpx2, openai, sqlite-utils>=4.0, pydantic>=2.0.0, pluggy and PyYAML. The pluggy dependency is what enables the plugin architecture. The version in pyproject.toml is 0.36.

Running Prompts, Setting Keys and Interactive Chat

After installation, the first step is setting an API key. For OpenAI:

bash
llm keys set openai

With a key set, a one-shot prompt runs as a positional argument:

bash
llm "Ten fun names for a pet pelican"

The README shows examples for extracting text from images and piping files through a system prompt:

bash
cat myfile.py | llm -s "Explain this code"

For interactive multi-turn chat, the llm chat subcommand starts a session:

bash
llm chat -m gpt-4.1

The README shows the chat interface prints the model name on entry, accepts !multi for multi-line input, !edit to open an editor for the prompt, and !fragment to insert stored content fragments into the conversation. Typing exit or quit ends the session. The -m flag selects the model; without it, the default model is used, which the README notes as gpt-5.6-luna in one example. Models can also be queried against images, audio and video, as announced in project news from October 2024.

Installing Plugins for Anthropic, Gemini and Ollama

The base llm package includes support for OpenAI-compatible APIs. Other providers are added through plugins, each of which is a separate pip-installable package. The README shows the pattern for Gemini and Anthropic:

bash
llm install llm-gemini
llm keys set gemini
bash
llm install llm-anthropic
llm keys set anthropic

For local models via Ollama:

bash
llm install llm-ollama

After the Ollama plugin is installed, models pulled through the ollama CLI are accessible directly:

bash
ollama pull llama3.2:latest
llm -m llama3.2:latest 'What is the capital of France?'

The plugin architecture uses pluggy, which means each plugin registers itself as an entry point and llm discovers it on startup. The README references a plugin directory at llm.datasette.io for the full list of available plugins. The uvx path from the README allows running against an arbitrary OpenAI-compatible endpoint without a permanent install, useful for testing local inference servers like LM Studio.

SQLite Logging, Embeddings and Schemas

Every prompt sent through llm and every response received is logged to a SQLite database. The logging capability is built into the core package via the sqlite-utils dependency. This makes llm useful as a lightweight audit trail for prompts, a way to review what a model said yesterday, or a source for analyzing prompt and response patterns over time.

Beyond prompt logging, llm supports two additional capabilities added through its history of development. The embeddings feature, added in September 2023, lets users generate and store vector embeddings for semantic search and similarity comparison. The schemas feature, announced in February 2025, allows extracting structured content from text and images by specifying a schema that the model should populate. Tool use was added in May 2025: models can be granted access to tools that execute on the local machine, effectively giving the model the ability to trigger defined functions during a conversation.

The README's project news section documents a significant refactor in April 2026 (LLM 0.32a0) described as a major backwards-compatible change. This history indicates the tool has grown from a simple prompt runner into a more general framework for working with language models locally, but the backwards-compatible framing means existing scripts and plugins should continue working across the 0.36 version.

Where llm Is Not the Right Choice

llm is a command-line tool and scripting aid, not a production API client library designed for high-throughput or fault-tolerant deployments. The pyproject.toml classifies it under Development Status :: 4 - Beta, which accurately reflects its positioning. There is no built-in retry logic, circuit breaker or rate-limit handling. A production service sending many requests per second needs a dedicated client library (the Anthropic Python SDK, the OpenAI Python library) with the reliability features those libraries provide.

The tool also assumes a local Python environment. Teams that deploy server-side automation in environments where pip is not available or where binary size matters will find the dependency footprint (click, httpx2, openai, sqlite-utils, pydantic, PyYAML, pluggy) adds meaningful weight. The Windows support note in pyproject.toml (pyreadline3 for Win32) suggests Windows compatibility is maintained but likely less tested than macOS and Linux paths.

Finally, the plugin ecosystem means that reliability depends on third-party maintainers. If the llm-anthropic plugin lags behind the Anthropic API's latest model list, you will not have access to new models until the plugin author updates it. The core package does not include all providers out of the box, which is the trade-off of an extensible architecture.

Development Activity and Apache-2.0 License

The last push to the repository was on 2026-09-22, the same date as the 0.36 release. Three releases appeared in September 2026 alone (0.34 on 2026-09-02, 0.35 on 2026-09-07 and 0.36 on 2026-09-22), which indicates active maintenance. The project history in the README news section goes back to April 2023 with continuous releases since then.

The license is Apache-2.0. Apache-2.0 is a permissive license that allows commercial use, modification and distribution, and includes an explicit patent grant. It requires that the license and NOTICE file be included in any redistribution and that significant modifications be marked as changed. The license imposes no copyleft conditions: you can use llm as a dependency in a proprietary product without being required to open-source the surrounding code.

The repository root contains AGENTS.md and a Justfile alongside the standard pyproject.toml and docs/ structure. The AGENTS.md file suggests the project documents AI agent interaction patterns, consistent with Simon Willison's public writing on using LLMs as development tools. The docs/ directory feeds a Sphinx documentation site hosted at llm.datasette.io.

Editorial conclusion

Engineers who want to query multiple LLM providers from the terminal without writing API client code will find llm practical and direct. The tool is less suitable for production systems that need fine-grained request control, retry logic or structured error handling: llm is a personal productivity and scripting tool, not a library designed around production reliability guarantees. The Apache-2.0 license imposes no restrictions on commercial use. Check the plugin directory at llm.datasette.io before writing a new provider integration: the README lists plugins for Gemini, Anthropic, Ollama and OpenRouter, and a plugin for your target provider may already exist.

Frequently asked questions

Is there a Python library for interacting with large language models from the command line?

simonw/llm is a Python package (pip install llm) that works both as a command-line tool and as a Python library. It supports OpenAI, Anthropic, Gemini, Ollama and many other providers through a plugin system. Every prompt and response is logged to SQLite automatically.

What models does simonw/llm support out of the box?

The base llm package includes support for OpenAI models and any OpenAI-compatible API. Other providers such as Anthropic, Google Gemini and Ollama require installing the corresponding plugin with llm install llm-anthropic, llm install llm-gemini or llm install llm-ollama. The full plugin directory is at llm.datasette.io.

How does llm store conversation history?

Every prompt sent and response received is automatically logged to a SQLite database. The sqlite-utils library handles this storage. The README documents a logging section at llm.datasette.io/en/stable/logging.html with details on querying and managing the stored history.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. simonw/llm on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/simonw-llm.svg)](https://hysenlabs.com/projects/simonw-llm)