llmllm is both a command-line tool and a Python library for working with large
language models. It is a good tool when you want prompts, chats, shell
pipelines, or Python scripts that you can rerun and adapt.
Compared to GitHub Copilot CLI or OpenCode, llm is less of a full coding
agent and more of a flexible interface for model access.
After working through this page, students should be better able to:
llm for a repeatable shell or Python-based workflowYou need two separate things:
llm package itselfThat second part is important. Installing llm does not automatically give you
model access. One common course path is to use the llm-github-copilot plugin
so llm can use your GitHub Copilot access. But llm can also use direct API
plugins and local-model plugins. See Model access.
The official docs list several installation methods:
pip install llm
pipx install llm
uv tool install llm
brew install llm
Use the method that fits how you normally install Python tools.
A common student setup is:
llmInstall the plugin:
llm install llm-github-copilot
Then log in:
llm github_copilot auth login
After that, list the available models:
llm models
Then try a prompt with one of the github_copilot/... models:
llm -m github_copilot/model-name "Give me three short study tips for learning a new CLI tool"
The plugin uses GitHub device login and can reuse GitHub Copilot access instead of requiring a separate API key for a different provider.
If you are using another access route, the exact plugin and authentication flow will differ. See Model access for the overview.
OpenAI models work directly in llm once you set a key:
llm keys set openai
llm models
llm -m gpt-4o-mini "Give me three short study tips for learning a new CLI tool"
Claude models usually mean installing the Anthropic plugin first:
llm install llm-anthropic
llm keys set anthropic
llm models
llm -m claude-haiku-4.5 "Give me three short study tips for learning a new CLI tool"
If you want a local route, install the Ollama plugin and use a model that is available on your Ollama server:
llm install llm-ollama
llm ollama models
llm -m gemma3 "Give me three short study tips for learning a new CLI tool"
The exact model name depends on what is available from your provider or local
server. llm models is the quickest way to check.
If you want the deeper local workflow, read Local models and Ollama.
These examples use the GitHub-backed route above. If you are using another
provider, replace github_copilot/model-name with one returned by llm models.
Some good starter patterns are:
llm -m github_copilot/model-name "Summarize the difference between Copilot CLI and OpenCode in three bullet points"
cat README.md | llm -m github_copilot/model-name -s "Explain this project to a new student"
llm chat -m github_copilot/model-name
llm models
Look for model names that start with github_copilot/.
llm is especially useful when you want work that is easy to rerun or turn
into a script. With llm-github-copilot, students can often do that using the
same GitHub account they already set up for student access. It is often the
best choice when you want to:
After installing llm and configuring access to a model, a minimal Python
script can look like this:
import llm
model = llm.get_model("your-model-name")
response = model.prompt(
"Explain when a student should use OpenCode instead of GitHub Copilot CLI."
)
print(response.text())
Use one of the model names returned by llm models, such as a
github_copilot/... model, claude-haiku-4.5, gpt-4o-mini, or a local
Ollama model.
For guidance on which model fits which kind of task, see Which model should I use?.
That same package also supports attachments, tools, JSON schemas, and async usage.
In course material you may see examples such as:
llm chat -m kth-gpt-5.2
A model name like kth-gpt-5.2 is not part of the default llm installation.
It is an example of a locally configured model or alias.
If you are following the GitHub-backed setup on this page, you will probably
start with a model name under github_copilot/....
If you use a direct API or local route instead, you may see names such as
claude-haiku-4.5, gpt-4o-mini, or a local Ollama model name.
So there are two separate questions:
llmThe first part is general. A common second step in this course is the
llm-github-copilot plugin, but it is not the only route.
By default, llm logs prompts and responses to a local SQLite database. That
is useful for experimentation, but it also means you should think about what
data you send to it. For the broader picture of data exposure and the legal
side, see Problematic cases of using AI.
Useful commands are:
llm logs status
llm logs off
llm logs on
llm-github-copilot if you already have GitHub Copilot accessllm models so you know which model you are actually callingWhen a model explains a repository, summarises a file, or claims that a command output means something important, verify that claim against the actual files or commands. For a reusable student workflow, read Verification.
llm helps most when you want direct control over prompts, scripts, logs, and
structured output. That makes it a useful contrast case:
Planning before editing: there is no built-in plan mode or separate
planning agent. You structure the prompt or script yourself.Limited context: chats and logs exist, but you decide what context to send
and when to start a fresh run.Work isolation: there is no central subagent workflow. If you want
separation, you usually create separate prompts, chats, or scripts.Instructions and memory: saved prompts, plugins, and logs are useful, but
they are not the same thing as a coding agent that loads project instructions
and manages its own memory layer.If you want the shared concepts across the coding-agent tools, read Agentic concepts.
llm.llm models and use one of the listed model names.