simonw’s llm cheatsheet
LLM is an intuitive CLI tool and Python library for interacting with LLMs. It supports both remote APIs and models run locally on your machine. It’s developed by Simon Willison (co-founder of Django), who tends to make complicated things easy to understand.
Installation with pipx
I prefer installing llm
with pipx
because it creates isolated environments for Python-based tools, avoiding dependency conflicts.
To install llm
:
pipx install llm
BashTo upgrade llm
:
pipx upgrade llm
BashManaging Plugins
llm
relies on plugins for different models and functionalities. You can find a directory of available plugins here.
To install a plugin:
llm install some_plugin
BashAPI Key Management
You’ll need to store API keys for LLM providers. More details can be found in the LLM Setup documentation.
To set an API key (e.g., for OpenAI):
llm keys set openai
BashThis will prompt you to enter the key:
% llm keys set openai
Enter key:
BashTo view your stored keys:
llm keys
BashExample output:
gemini
openai
openrouter
perplexity
BashTo find where the keys are stored:
llm keys path
BashExample path on Windows:
C:\Users\testycool\AppData\Roaming\io.datasette.llm\keys.json
BashConfiguring Default Models
To view your current default model:
llm models default
BashExample default:
gemini/gemini-2.5-flash-preview-05-20
BashTo set your default model:
llm models default model_name
BashListing Available Models
To see all available models configured with your installed plugins and keys:
llm models list
BashExample output (your list may vary based on installed plugins and configured keys):
OpenAI Chat: gpt-4o (aliases: 4o)
OpenAI Chat: chatgpt-4o-latest (aliases: chatgpt-4o)
OpenAI Chat: gpt-4o-mini (aliases: 4o-mini)
...
GeminiPro: gemini/gemini-2.0-pro-exp-02-05 (aliases: gemini-2.0-pro-exp-02-05)
GeminiPro: gemini/gemini-2.0-flash-lite (aliases: gemini-2.0-flash-lite)
GeminiPro: gemini/gemini-2.5-pro-exp-03-25 (aliases: gemini-2.5-pro-exp-03-25)
GeminiPro: gemini/gemini-2.5-pro-preview-03-25 (aliases: gemini-2.5-pro-preview-03-25)
GeminiPro: gemini/gemini-2.5-flash-preview-04-17 (aliases: gemini-2.5-flash-preview-04-17)
GeminiPro: gemini/gemini-2.5-pro-preview-05-06 (aliases: gemini-2.5-pro-preview-05-06)
GeminiPro: gemini/gemini-2.5-flash-preview-05-20 (aliases: gemini-2.5-flash-preview-05-20)
Default: gemini/gemini-2.5-flash-preview-05-20
BashDaily Use with Gemini
For day-to-day usage, I prefer Gemini because it’s free. First, you need to install the llm-gemini
plugin:
llm install llm-gemini
Bash