Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

llm

> AI 编程
Open source

Access large language models from the command-line

12.3K stars0 likes2 views
WebsiteGitHub

About

Access large language models from the command-line

LLM

A CLI tool and Python library for interacting with OpenAI, Anthropic’s Claude, Google’s Gemini, Qwen, Gemma, Kimi, DeepSeek, Mistral, and dozens of other Large Language Models, both via remote APIs and with models that can be installed and run on your own machine.

Watch Language models on the command-line on YouTube for a demo or read the accompanying detailed notes.

With LLM you can:

  • Run prompts from the command-line
  • Store prompts and responses in SQLite
  • Generate and store embeddings
  • Extract structured content from text and images
  • Grant models the ability to execute tools
  • … and much, much more

Quick start

First, install LLM using pip or Homebrew or pipx or uv:

bash
pip install llm

Or with Homebrew (see warning note):

bash
brew install llm

Or with pipx:

bash
pipx install llm

Or with uv

bash
uv tool install llm

Use LLM to run prompts or start chats against an arbitrary OpenAI-compatible Chat Completions endpoint, such as LM Studio. With uvx, you can do this without installing LLM first:

bash
uvx llm openai endpoint http://localhost:1234/v1 \
  -m google/gemma-4-12b \
  "What is the capital of France?"

uvx llm openai endpoint http://localhost:1234/v1 \
  -m google/gemma-4-12b \
  --chat

Add --key your-api-key if the endpoint requires authentication. See Run against an endpoint without configuring it for more options.

If you have an OpenAI API key key you can run this:

bash
# Paste your OpenAI API key into this
llm keys set openai

# Run a prompt (with the default gpt-5.6-luna model)
llm "Ten fun names for a pet pelican"

# Extract text from an image
llm "extract text" -a scanned-document.jpg

# Use a system prompt against a file
cat myfile.py | llm -s "Explain this code"

Run prompts against Gemini or Anthropic with their respective plugins:

bash
llm install llm-gemini
llm keys set gemini
# Paste Gemini API key here
llm -m gemini-3.5-flash 'Tell me fun facts about Mountain View'

llm install llm-anthropic
llm keys set anthropic
# Paste Anthropic API key here
llm -m claude-sonnet-5 'Impress me with wild facts about turnips'

You can also install a plugin to access models that can run on your local device. If you use Ollama:

bash
# Install the plugin
llm install llm-ollama

# Download and run a prompt against the Orca Mini 7B model
ollama pull llama3.2:latest
llm -m llama3.2:latest 'What is the capital of France?'

To start an interactive chat with a model, use llm chat:

bash
llm chat -m gpt-4.1
default
Chatting with gpt-4.1
Type 'exit' or 'quit' to exit
Type '!multi' to enter multiple lines, then '!end' to finish
Type '!edit' to open your default editor and modify the prompt.
Type '!fragment <my_fragment> [<another_fragment> ...]' to insert one or more fragments
> Tell me a joke about a pelican
Why don't pelicans like to tip waiters?

Because they always have a big bill!

Project news

  • 29th April 2026: LLM 0.32a0 is a major backwards-compatible refactor
  • 11th August 2025: LLM 0.27, the annotated release notes: GPT-5 and improved tool calling
  • 27th May 2025: Large Language Models can run tools in your terminal with LLM 0.26
  • 5th May 2025: Feed a video to a vision LLM as a sequence of JPEG frames on the CLI (also LLM 0.25)
  • 7th April 2025: Long context support in LLM 0.24 using fragments and template plugins
  • 28th February 2025: Structured data extraction from unstructured content using LLM schemas
  • 17th February 2025: LLM 0.22, the annotated release notes
  • 29th October 2024: You can now run prompts against images, audio and video in your terminal using LLM
  • 26th January 2024: LLM 0.13: The annotated release notes
  • 12th September 2023: Build an image search engine with llm-clip, chat with models with llm chat
  • 4th September 2023: LLM now provides tools for working with embeddings
  • 12th July 2023: The LLM CLI tool now supports self-hosted language models via plugins
  • 18th May 2023: llm, ttok and strip-tags—CLI tools for working with ChatGPT and other LLMs
  • 4th April 2023: The original announcement of the llm CLI tool

For everything else, see the llm tag on my blog.

Contents

  • Setup
    • Installation
    • Upgrading to the latest version
    • Using uvx
    • A note about Homebrew and PyTorch
    • Installing plugins
    • API key management
      • Saving and using stored keys
      • Passing keys using the –key option
      • Keys in environment variables
    • Configuration
      • Setting a custom default model
      • Setting a custom directory location
      • Turning SQLite logging on and off
  • Usage
    • Executing a prompt
      • Model options
      • Attachments
      • System prompts
      • Tools
      • Extracting fenced code blocks
      • JSON output
      • Schemas
      • Fragments
      • Continuing a conversation
      • Tips for using LLM with Bash or Zsh
      • Completion prompts
    • Starting an interactive chat
    • Listing available models
    • Setting default options for models
  • OpenAI models
    • Configuration
    • OpenAI language models
    • Model features
    • Web Search
    • Code Interpreter
    • Fast mode and service tiers
    • OpenAI embedding models
    • OpenAI completion models
    • Adding more OpenAI models
  • Other models
    • Installing and using a local model
    • OpenAI-compatible models
      • Run against an endpoint without configuring it
      • Configure an OpenAI-compatible model
      • Extra HTTP headers
  • Tools
    • How tools work
    • Trying out tools
    • LLM’s implementation of tools
    • Default tools
    • Tips for implementing tools
  • Schemas
    • Schemas tutorial
      • Getting started with dogs
      • Extracting people from a news articles
    • Using JSON schemas
    • Ways to specify a schema
    • Concise LLM schema syntax
    • Saving reusable schemas in templates
    • [Browsing logged JSON objects created using schemas](https://llm.datasette.io/en/stable/schemas.html#browsing-

Issues· 715 open

View all issuesOpen on GitHub
  • #1722

    Collection.embed_multi silently accepts an incorrect number of embeddings

    Updated Sep 28, 2026
  • #1720

    Embedding Python APIs silently return without processing input when batch_size is zero

    Updated Sep 28, 2026
  • #1703

    Make reasoning effort a top-level -e/--effort concept, for consistency across models

    enhancementdesignUpdated Sep 22, 2026
  • #1696

    gpt-5.2-chat-latest is still registered but OpenAI shut it down on 2026-08-10 — and 8 more registered IDs have published shutdown dates, the first in 12 days

    Updated Sep 21, 2026
  • #1699

    Should the plugin directory list a provider with no key to store?

    Updated Sep 21, 2026
  • #1697

    `--no-stream` crashes with AttributeError when an OpenAI-compatible endpoint omits `usage`

    Updated Sep 21, 2026
  • #1689

    OpenAI-compatible endpoints discard llama.cpp reasoning_content from Chat Completions responses

    Updated Sep 18, 2026
  • #1681

    Populate resolved_model in the default OpenAI plugin from the response `model` field

    Updated Sep 12, 2026
  • #1679

    Tool parameter named "title" is stripped from input_schema but kept in required

    Updated Sep 11, 2026
  • #1678

    llm templates listing should surface pinned model, schema and tools

    Updated Sep 8, 2026

> Tags

Pythonaillmsopenai

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.