Skip to main content

LLM CLI Cheatsheet

`llm` is a lightweight command-line LLM tool supporting OpenAI, Claude, Gemini, Ollama, GPT4All, and more via plugins. Features include prompt templates, interactive chat, embedding generation, and semantic search — the most convenient way to interact with LLMs from the terminal.

Updated: 2026-07-20·24 commands

Quick Start

``bash # Install pip install llm

# Set an API key llm keys set openai

# Ask a question llm 'What is the capital of Japan?'

# Use a different model llm -m claude-3-haiku-20240307 'Write a haiku'

# Chat interactively llm chat

# Continue the conversation llm -c 'Tell me more' `

Supported Models

Out of the box: OpenAI (GPT-4o, GPT-4o-mini). Via plugins: Claude (llm-claude-3), Gemini (llm-gemini), Ollama (llm-ollama, for local models), GPT4All (llm-gpt4all, fully offline), and many community plugins.

Chat & Conversation

llm chat starts an interactive session. Use -c to continue any previous conversation. Use llm logs to browse history. Conversations include system prompts, user messages, and model responses in a persistent SQLite database.

Prompt Templates

Create reusable prompt templates with llm templates edit . Templates use Jinja-style {{variable}} syntax. Use them with llm -t 'value'. Pre-installed templates include various summarization and extraction patterns.

llm includes a complete embedding workflow: llm embed for single texts, llm embed-multi for batch embedding documents, and llm similar for semantic search. Embeddings are stored in SQLite and can be exported for use in other tools.

Plugin System

llm's power comes from its plugin ecosystem. Install plugins with pip install llm-. List installed plugins with llm plugins`. Community plugins add models, embedding functions, template loaders, and more.

Startup & Modes(20)

CommandLevel
llm --help
Show llm CLI help
Basic
llm 'prompt'
Query LLM directly with prompt argument (core usage)
Basic
llm -m
Specify which model to use
Basic
llm -m claude-3-opus-20240307
Use Claude Opus model
Basic
llm -m gpt4all
Use local GPT4All model (offline)
Intermediate
llm -m ollama
Use Ollama-managed local model
Intermediate
llm -s
Set system prompt
Basic
llm logs
View recent conversation history
Basic
llm logs -n
Show last N conversation records
Basic
llm -c
Continue last conversation (appends to context)
Intermediate
llm chat
Start interactive chat mode
Basic
llm chat -m
Specify model in interactive mode
Basic
llm keys
List configured API keys
Basic
llm keys set
Set an API key
Basic
llm keys get
Get stored API key value
Basic
pip install llm
Install llm CLI tool
Basic
pip install llm-claude-3
Install Claude plugin
Basic
llm plugins
List installed plugins
Basic
llm templates
List prompt templates
Intermediate
llm templates edit
Edit a prompt template
Intermediate

ai-embedding(4)

CommandLevel
llm embed
Generate text embeddings
Intermediate
llm embed-multi
Batch generate embeddings (from file)
Expert
llm embed-multi --files
Batch embed from directory files
Expert
llm similar
Query semantically similar text
Expert

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-20.