Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/simonw/LLM/llms.txt

Use this file to discover all available pages before exploring further.

LLM puts the power of large language models directly in your terminal. In the next five minutes you’ll install the tool, authenticate with OpenAI, run your first prompt, try piping files through a system prompt, start an interactive chat session, and extend LLM with a plugin to access Anthropic or Gemini models — no boilerplate, no SDK setup.
LLM’s default model is gpt-4o-mini — OpenAI’s fastest and most cost-effective model. You can change this at any time with llm models default <model-id>.
1

Install LLM

Install LLM with pip, pipx, uv, or Homebrew. pip is the simplest:
pip install llm
Verify the installation:
llm --version
You should see output like llm, version 0.32.
2

Set your OpenAI API key

LLM needs an API key to call OpenAI. Get one from platform.openai.com/api-keys, then store it:
llm keys set openai
You’ll be prompted to paste it:
% llm keys set openai
Enter key:
The key is saved to a local keys.json file and used automatically from here on. Run llm keys path to see where it is stored.
3

Run your first prompt

Pass a prompt as a quoted string directly to llm:
llm "Ten fun names for a pet pelican"
Example output:
1. Pelican Pete
2. Bill Murray
3. Captain Scoop
4. Sir Gulps-a-Lot
5. Fishwhisker
6. Waddles McBeak
7. Barnacle Bob
8. The Pelicandor
9. Scoopsworth
10. Percy the Plunge
LLM streams the response in real time. Every prompt and response is automatically logged to a local SQLite database — run llm logs to browse your history.
Use -m to pick a different model for any single prompt without changing your default:
llm -m gpt-4o "Ten fun names for a pet pelican"
4

Pipe a file through a system prompt

LLM reads from standard input, so you can pipe any file directly into it. Use -s to supply a system prompt that tells the model what to do with the content:
cat myfile.py | llm -s "Explain this code"
Example output for a short Python file:
This script defines a function called `fetch_titles` that takes a list of
URLs, sends an HTTP GET request to each one, parses the HTML response, and
returns a list of page titles extracted from the <title> tag.

It uses the `requests` library for HTTP and `BeautifulSoup` for parsing.
Piping works with any text: logs, configs, markdown, JSON, CSV, and more. Combine with other Unix tools for powerful one-liners:
# Summarize the last 50 lines of a log file
tail -50 app.log | llm -s "Summarize any errors or warnings"

# Explain a shell command
echo 'find . -name "*.py" | xargs wc -l | sort -rn' | llm -s "Explain this command"
5

Start an interactive chat session

Use llm chat to open a persistent, multi-turn conversation with a model. Type messages at the > prompt; the model remembers the full conversation history:
llm chat -m gpt-4o
Chatting with gpt-4o
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!

> Now make it about a flamingo instead
Why don't flamingos ever win at poker?

Because they always show their hand by standing on one leg!

> exit
Type exit or quit to end the session. Use !multi to paste multi-line input, and !edit to open your $EDITOR for longer prompts.
6

Install a plugin and use Anthropic or Gemini

LLM’s plugin system lets you add support for any model provider. Install a plugin with llm install, then set its API key and start using the new models immediately.Anthropic (Claude models):
llm install llm-anthropic
llm keys set anthropic
# Paste your Anthropic API key from console.anthropic.com
Run a prompt with Claude:
llm -m claude-4-opus "Impress me with wild facts about turnips"
Google Gemini:
llm install llm-gemini
llm keys set gemini
# Paste your Gemini API key from aistudio.google.com/apikey
Run a prompt with Gemini:
llm -m gemini-2.0-flash "Tell me fun facts about Mountain View"
Local models with Ollama:If you have Ollama installed and running locally:
llm install llm-ollama
ollama pull llama3.2:latest
llm -m llama3.2:latest "What is the capital of France?"
This runs entirely on your own machine — no API key required.
Run llm models at any time to see the full list of available models across all installed plugins.

What’s Next?

You’ve covered the core workflow. Here are some directions to explore:
  • System prompts & templates — Save reusable system prompts as named templates with llm --save and apply them with llm -t <template>.
  • Structured output — Extract typed JSON from any text using --schema. Great for data pipelines and automation.
  • Embeddings — Generate vector embeddings and run semantic similarity searches with llm embed and llm similar.
  • Tools — Grant models the ability to call Python functions during a prompt with the --tool flag.
  • Log browsing — Search and replay your full prompt history with llm logs or open it in Datasette.

Build docs developers (and LLMs) love