LLM is a command-line tool and Python library for working with large language models, both hosted models reached through remote APIs and models installed and run on your own machine. You run a prompt from the terminal, pipe a file into it with a system prompt, attach an image to extract its text, or open an interactive chat, and every prompt and response is logged to a SQLite database you can browse later, for example with Datasette.
OpenAI models work out of the box, and plugins add other providers and local runtimes: Anthropic's Claude, Google's Gemini, Mistral, DeepSeek, Qwen, Kimi, and models served through Ollama. Any OpenAI-compatible Chat Completions endpoint, such as LM Studio, also works directly without configuring a plugin. A plugin system with documented hooks lets developers add new models, embedding models, tools, template loaders, and fragment sources.
Beyond single prompts, LLM generates and stores embeddings, extracts structured data from text and images against JSON schemas, and grants models the ability to execute tools. Templates save reusable prompts, fragments insert long context into a prompt or chat, and model aliases give short names to long model IDs. The same capabilities are available from Python, including async models and multi-turn conversations.
Features
- Prompts and chat: run one-off prompts with optional system prompts and attachments, or start an interactive chat with any installed model
- SQLite logging: stores every prompt and response in SQLite, with log viewing and browsing through Datasette
- Model plugins: adds remote providers and local models through plugins, including Claude, Gemini, and Ollama
- OpenAI-compatible endpoints: runs prompts against any Chat Completions endpoint, such as LM Studio, without configuring it first
- Embeddings: generates and stores embeddings from the CLI or Python, with plugins for new embedding models
- Schemas: extracts structured content from text and images using JSON schemas or a concise schema syntax
- Tools: grants models the ability to execute tools, including a set of default tools
- Templates and fragments: saves reusable prompts as YAML templates and inserts long-context fragments into prompts and chats
- Model aliases: assigns short aliases to model IDs
- Python API: prompt execution, async models, conversations, and model listing from Python code

