LLM logo

LLM

Free

A CLI utility and Python library for interacting with Large Language Models, remote and local. [#opensource](https://github.com/simonw/llm)

FreeFree tier
Inputs: text, image, audio, videoOutputs: text
Type
Open Source

About LLM

LLM is an open-source CLI tool and Python library for interacting with dozens of large language models (LLMs) from OpenAI, Anthropic, Google, Meta, and more. It supports both remote APIs and locally running models (via plugins like Ollama). Users can run prompts from the command line, store conversation logs and responses in SQLite, generate and query embeddings, extract structured data from text and images, and grant models the ability to execute tools. Additional features include interactive chat mode, system prompts, template fragments, model aliases, and a plugin system for adding new models or embedding functions. LLM is designed for developers, data scientists, and anyone who wants to interact with LLMs efficiently from the terminal or within Python scripts.

Key Features

Run prompts from the command line against various LLMs
Store prompts, responses, and metadata in SQLite
Generate and store embeddings for text and images
Extract structured data (e.g., JSON) from unstructured content using schemas
Grant models the ability to execute tools (function calling)
Plugin system to add support for new models (Gemini, Claude, Ollama, etc.)
Interactive chat mode with llm chat command
Support for system prompts, fragments, and template plugins
Run prompts against images, audio, and video inputs

Pros & Cons

Pros
  • Open source and completely free to use
  • Supports a wide range of models (OpenAI, Anthropic, Google, Meta, local via Ollama)
  • Can run both remote APIs and local models, giving flexibility
  • Stores all interactions in SQLite for easy querying and reproducibility
  • Extensible via plugins for custom models and embedding functions
  • Supports multimodal inputs (images, audio, video) for compatible models
  • Enables structured data extraction directly from prompts
  • Interactive chat mode with session history
Cons
  • Requires API keys for remote models (OpenAI, etc.)
  • Local model support depends on external tools like Ollama or llama.cpp plugins
  • Primarily command-line based, no graphical user interface
  • Some advanced features (plugins, schemas) have a learning curve
  • Python installation and dependency management required

Best For

Querying LLMs from the terminal or in scripts for quick answersLogging and reviewing all model interactions for auditing or analysisBuilding custom search engines using embeddingsExtracting structured information from scanned documents or imagesExplaining code or files via system promptsDeveloping plugins to run models locally or from new providersInteractive conversations with models for brainstorming or debugging

FAQ

How do I install LLM?
You can install LLM using pip, Homebrew, pipx, or uv. For example: pip install llm, brew install llm, pipx install llm, or uv tool install llm.
How do I use LLM with OpenAI?
Set your OpenAI API key with 'llm keys set openai' and then run a prompt with 'llm Ten fun names for a pet pelican'. The default model is gpt-4o-mini.
Can I use local models with LLM?
Yes, install a plugin like llm-ollama and then use Ollama to download and run local models. For example: 'ollama pull llama3.2:latest' and then 'llm -m llama3.2:latest "What is the capital of France?"'.
Does LLM support chat interactions?
Yes, use the 'llm chat' command to start an interactive chat session with a model. Type 'exit' to quit.
Can I generate embeddings with LLM?
Yes, LLM can generate and store embeddings. You can use the CLI or Python API to create embeddings and then use them for search or similarity tasks.
Is LLM free or open source?
LLM is completely free and open source. You can find the source code on GitHub at github.com/simonw/llm.