llm

(★ 12,379)

Access large language models from the command-line

File Explorer

  • .gitignore
  • .readthedocs.yaml
  • AGENTS.md
  • Justfile
  • LICENSE
  • MANIFEST.in
  • mypy.ini
  • pyproject.toml
  • pytest.ini
  • README.md
  • ruff.toml

# Installation Guide

python
Prerequisites

Setup Steps

pip install llm

Install the llm package using pip.

llm keys set openai

Configure your OpenAI API key.

llm "Ten fun names for a pet pelican"

Run a prompt using the installed LLM tool.

Video Guides

Language models on the command-line

Key Commands

pip install llm

Install llm using the Python package manager.

llm keys set openai

Save your OpenAI API key securely.

llm "Hello world"

Send a prompt to the large language model.

llm chat -m gpt-4.1

Start an interactive chat session with a model.

llm install llm-gemini

Install a plugin for additional features.

API keys for respective providers like OpenAI, Anthropic, or Gemini may be required.

# Use via CDN

jsDelivr

jsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.

Release Timeline

Actively Maintained

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

brew install

View Details ▼

Install a Homebrew formula or cask.

brew install {{formula|cask}}

Install a formula/cask:

brew install {{[-s|--build-from-source]}} {{formula}}

Build and install a formula from source (dependencies will still be installed from bottles):

brew install {{[-n|--dry-run]}} {{formula|cask}}

Download the manifest, print what would be installed but don't actually install anything:

🔍

llm

View Details ▼

Interact with Large Language Models (LLMs) via remote APIs and models that can be installed and run on your machine.

llm keys set openai

Set up an OpenAI API Key:

llm "{{Ten fun names for a pet pelican}}"

Run a prompt:

cat {{path/to/file.py}} | llm {{[-s|--system]}} "{{Explain this code}}"

Run a system prompt against a file:

🔍

ollama

View Details ▼

A large language model runner.
For a list of available models, see <https://ollama.com/library>.

ollama serve

Start the daemon required to run other commands:

ollama run {{model}}

Run a model and chat with it (will automatically download the model if it's not downloaded):

ollama run {{model}} --think=false "{{prompt}}"

Run a model with a single prompt and thinking turned off:

🔍

pip install

View Details ▼

Install Python packages.

pip install {{package1 package2 ...}}

Install one or more packages:

pip install {{package1 package2 ...}} {{[-U|--upgrade]}}

Upgrade all specified packages to the latest version, installing any that are not already present:

pip install {{package}}=={{version}}

Install a specific version of a package:

🔍

pip

View Details ▼

Python package manager.
Some subcommands such as `install` have their own usage documentation.

pip install {{package}}

Install a package (see `pip install` for more install examples):

pip install --user {{package}}

Install a package to the user's directory instead of the system-wide default location:

pip install {{[-U|--upgrade]}} {{package}}

Upgrade a package:

🔍

pipx

View Details ▼

Install and run Python applications in isolated environments.

pipx run {{pycowsay}} {{moo}}

Run an app in a temporary virtual environment:

pipx install {{package}}

Install a package in a virtual environment and add entry points to path:

pipx uninstall {{package}}

Uninstall a package:

🔍

sphinx-build

View Details ▼

Sphinx documentation generator.

sphinx-build {{[-b|--builder]}} {{html|epub|text|latex|man|...}} {{path/to/source_directory}} {{path/to/build_directory}}

Build documentation:

sphinx-build {{[-b|--builder]}} {{html}} {{path/to/docs_directory}} {{path/to/build_directory}}

Build documentations intended for readthedocs.io (requires the sphinx-rtd-theme pip package):

🔍

uv tool

View Details ▼

Install and run commands provided by Python packages.

uv tool run {{command}}

Run a command from a package, without installing it:

uv tool install {{package}}

Install a Python package system-wide:

uv tool upgrade {{package}}

Upgrade an installed Python package:

🔍

uvx

View Details ▼

This command is an alias of `uv tool run`.

tldr uv tool

View documentation for the original command:

// repository documentation