Repolode
simonw

simonw/llm

A command-line tool and Python library for running prompts and chats against remote and locally installed large language models.

Open-source alternative to:ChatGPT

Stars
12,646
Forks
1,053
Open issues
753
Last commit
2 days ago

What is it?

LLM is a CLI tool and Python library for interacting with large language models such as OpenAI, Anthropic Claude, Google Gemini, Mistral, and DeepSeek, as well as models that run on your own machine. Plugins extend it to additional providers, including Ollama for local models and any OpenAI-compatible endpoint such as LM Studio.

Beyond running prompts, it can store prompts and responses in SQLite, generate and store embeddings, extract structured JSON from text and images, and let models call tools. Prompts can be built from reusable templates and fragments, and attachments allow images, audio, and video to be passed to multimodal models.

The project is aimed at developers and power users who want to work with LLMs from the terminal or scripts, with a Python API available for the same functionality.

Key features

  • 01Runs prompts and interactive chats from the command line.
  • 02Logs prompts and responses to SQLite for later search and review.
  • 03Generates and stores embeddings for similarity search.
  • 04Extracts structured data using JSON schemas.
  • 05Lets models call tools, and accepts images, audio, and video as attachments.
  • 06Supports remote APIs and local models through a plugin system.

Use cases

  • Querying models from shell scripts or piping file contents into a prompt.
  • Building a local searchable history of LLM conversations.
  • Testing prompts across several providers from one interface.
  • Extracting structured records from documents or images.

Quick start

  1. 1

    Install LLM with pip

    pip install llm
  2. 2

    Save your OpenAI API key

    llm keys set openai
  3. 3

    Run a prompt with the default model

    llm "Ten fun names for a pet pelican"

Things to know

  • Remote models such as OpenAI, Gemini and Anthropic need paid API keys.
  • Running models on your own machine requires installing separate plugins and a local model runner such as Ollama.

Topics

FAQ

What is llm?
A command-line tool and Python library for running prompts and chats against remote and locally installed large language models. LLM is a CLI tool and Python library for interacting with large language models such as OpenAI, Anthropic Claude, Google Gemini, Mistral, and DeepSeek, as well as models that run on your own machine. Plugins extend it to additional providers, including Ollama for local models and any OpenAI-compatible endpoint such as LM Studio.
Is llm free to use? What license does it have?
llm is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is llm still maintained?
Actively maintained. The last commit to llm was on Oct 18, 2026.
What can I use llm for?
Querying models from shell scripts or piping file contents into a prompt. Building a local searchable history of LLM conversations. Testing prompts across several providers from one interface. Extracting structured records from documents or images.
How do I install llm?
Install LLM with pip: pip install llm Save your OpenAI API key: llm keys set openai Run a prompt with the default model: llm "Ten fun names for a pet pelican"
Where can I get llm?
The source code and installation instructions are on GitHub: https://github.com/simonw/llm

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects