# LLM

> Access dozens of language models from the command line, and log every one to SQLite

- Category: App Orchestration / App Frameworks
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/simonw/llm
- Website: https://llm.datasette.io
- Canonical page: https://ai-tldr.dev/tools/llm/
- Updated: 2026-08-22

## In short

LLM is a command-line tool and Python library, created by Simon Willison, for interacting with OpenAI, Anthropic's Claude, Google's Gemini, Qwen, Gemma, Kimi, DeepSeek, Mistral and dozens of other language models — both through remote APIs and through models installed on your own machine. It sits in the App Frameworks category of the App Orchestration tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

LLM is a command-line tool and Python library, created by Simon Willison, for interacting with OpenAI, Anthropic's Claude, Google's Gemini, Qwen, Gemma, Kimi, DeepSeek, Mistral and dozens of other language models — both through remote APIs and through models installed on your own machine. The design principle is that a language model is a Unix-shaped thing: you pipe a file into it, give it a system prompt, and get text back on stdout.

Provider support is a plugin system rather than a monolith. The core package ships OpenAI-compatible support, including the ability to point at any OpenAI-compatible endpoint such as a local LM Studio server, and `llm install llm-gemini`, `llm install llm-anthropic` or `llm install llm-ollama` add the rest. Keys are managed by the tool with `llm keys set`, so credentials do not need to live in your shell profile.

Beyond one-shot prompting, LLM stores every prompt and response in SQLite, runs an interactive `llm chat` session, generates and stores embeddings, extracts structured content from text and images with schemas, and grants models the ability to execute tools. It installs from pip, Homebrew, pipx or uv, and can be run without installing at all through uvx.

## What it does

- One CLI over remote APIs and locally installed models, with providers added as plugins (llm-gemini, llm-anthropic, llm-ollama and many more)
- Every prompt and response logged to a local SQLite database you can query afterwards
- Attachments: run prompts against images, audio and video with the -a option
- Embeddings generation and storage, so the same tool builds a semantic index
- Schemas for extracting structured content out of unstructured text and images
- Tool execution — models can be granted the ability to run tools from your terminal
- Interactive chat mode with multi-line input, an editor escape, and fragment insertion

## Getting started

LLM installs from pip, Homebrew, pipx or uv. Set a key once, then prompt. Everything below is from the project's own quick start.

1. Install it

   Any of these work; uv and pipx keep it isolated from your project environments.

```bash
pip install llm
# or: brew install llm
# or: pipx install llm
# or: uv tool install llm
```

2. Store a key and run a prompt

   llm keys set saves the key for you. The bare llm command runs against the default model.

```bash
llm keys set openai
llm "Ten fun names for a pet pelican"
```

3. Pipe files in, send images

   -s sets a system prompt, -a attaches a file such as an image.

```bash
cat myfile.py | llm -s "Explain this code"
llm "extract text" -a scanned-document.jpg
```

4. Add other providers, or a local model

   Each provider is a plugin. llm-ollama runs whatever you have pulled locally; you can also point at any OpenAI-compatible endpoint without configuring it first.

```bash
llm install llm-anthropic
llm keys set anthropic
llm -m claude-sonnet-5 'Impress me with wild facts about turnips'

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

5. Chat interactively

   llm chat keeps the conversation open, with !multi for multi-line input and !edit to open your editor.

```bash
llm chat -m gpt-4.1
```

## When to use it

- Use a model inside a shell pipeline — pipe a file in, get an explanation or a rewrite out
- Compare the same prompt across several providers and local models without writing per-vendor client code
- Keep an auditable local SQLite log of everything you have asked a model and everything it answered
- Build a small embeddings-backed search over your own notes or documents from the command line
- Extract structured JSON out of scanned documents or unstructured text using schemas

## Version history

- 2026-08-22 0.33: LLM 0.33 moved onto the OpenAI Python library 3.x and httpx2, let embedding commands take a per-call API key, and allowed templates to be combined.
