Installation
Install ipyllm from PyPI into the same Python environment used by IPython:
python -m pip install ipyllm
The project requires Python 3.11 or newer. If you are installing from a local project checkout, use:
python -m pip install .
Configure a model
ipyllm uses the model and provider configuration managed by
llm. Configure a provider key, then choose a
default model:
llm keys set PROVIDER
llm models
llm models default MODEL
For local Ollama models, the llm-ollama plugin is included. Install and start
Ollama, then select an installed model with llm models default MODEL.
Install remote provider support
The optional providers dependency group installs plugins for Anthropic,
DeepSeek, Gemini, Grok, Mistral, OpenRouter, and Perplexity. In a checkout of
this project, install the group and run IPython in the resulting environment:
uv sync --group providers
uv run ipython
uv run uses the project environment, so you do not need to activate it
manually. If you prefer an activated shell, use source .venv/bin/activate
on macOS/Linux or .venv\Scripts\activate on Windows, then run ipython.
The group installs these plugins: llm-anthropic, llm-deepseek,
llm-gemini, llm-grok, llm-mistral, llm-openrouter, and
llm-perplexity. If you installed ipyllm into another environment rather
than syncing this checkout, install the plugin package(s) you need into that
same environment, for example:
python -m pip install llm-anthropic llm-gemini
Configure credentials for each provider using the key name documented by its
plugin. You can store a key with llm keys set PROVIDER, or set the provider's
documented environment variable in the shell before starting IPython. For
example, llm keys set anthropic stores an Anthropic key; environment
variables must be available to the IPython process.
Then list available models and choose one:
llm models
llm models default MODEL
See the llm remote API plugin directory
for the supported providers and links to plugin-specific setup instructions.
The llm API key guide
covers stored keys and environment variables.
Load the extension
Start IPython or a Jupyter IPython kernel from the configured environment and load the extension:
%load_ext ipyllm
To load it automatically each time IPython starts, add this to the profile's
ipython_config.py:
c.InteractiveShellApp.extensions = ["ipyllm"]
See the IPython configuration guide for profile locations and configuration details.