Pi
An open-source, multi-provider coding agent with a powerful extension system.
What is Pi?
Pi is an open-source AI coding agent built on a modular architecture. Unlike single-provider agents, Pi connects to any AI provider — Anthropic, OpenAI, Google, Groq, Mistral, Ollama, or any OpenAI-compatible endpoint. It features a rich extension system, built-in skills, and a session tree that lets you fork and navigate conversation branches.
Key Features
Use any AI provider: Anthropic (Claude), OpenAI (GPT), Google (Gemini), Groq, Mistral, Ollama, or any OpenAI-compatible API. Switch models mid-session.
Extend Pi with custom tools, commands, and UI elements via the extension API. Extensions can register tools, add commands, and show dialogs on your phone.
Navigate your conversation as a tree. Fork from any point to explore different approaches without losing context. Export sessions to HTML.
Pi includes skills for git workflows, code review, documentation, investigation, and more — loaded on demand to keep context focused.
Auto-compaction keeps sessions within context limits. Configurable reserve tokens, retry policies, and thinking budgets per model.
Setup
1. Install Pi
npm i -g @mariozechner/pi-coding-agent2. Configure a Provider
Pi needs at least one AI provider API key. Set the environment variable for your preferred provider:
# Anthropic (Claude)
export ANTHROPIC_API_KEY=sk-ant-...
# OpenAI (GPT)
export OPENAI_API_KEY=sk-...
# Google (Gemini)
export GOOGLE_GENERATIVE_AI_API_KEY=...
# Groq
export GROQ_API_KEY=gsk_...
# Or any OpenAI-compatible endpoint
export OPENAI_API_BASE=http://localhost:11434/v1
export OPENAI_API_KEY=ollama3. Start Broski
broskiSelect Pi as your backend in the Broski app settings.
Supported Providers
| Provider | Models | API Key Variable |
|---|---|---|
| Anthropic | Claude 4 Sonnet, Claude 4 Opus, Claude 3.5 Sonnet | ANTHROPIC_API_KEY |
| OpenAI | GPT-4o, GPT-4o mini, o1, o3 | OPENAI_API_KEY |
| Gemini 2.5 Pro, Gemini 2.5 Flash | GOOGLE_GENERATIVE_AI_API_KEY | |
| Groq | Llama, Mixtral | GROQ_API_KEY |
| Mistral | Mistral Large, Codestral | MISTRAL_API_KEY |
| Ollama | Any local model | OPENAI_API_BASE + OPENAI_API_KEY |
Thinking Levels
Pi supports configurable thinking levels for models that support extended thinking (Claude, o1/o3, Gemini). Toggle thinking from the chat overflow menu in Broski.
| Level | Description | Best For |
|---|---|---|
| Off | No extended thinking | Fast responses, simple tasks |
| Low | Brief reasoning | Standard coding tasks |
| High | Deep reasoning | Complex architecture, debugging |
Extensions
Pi's extension system lets you add custom tools, commands, and UI interactions. Extensions are loaded from your project or global configuration.
# Extensions are configured in Pi settings
# View available extensions in Broski:
# Chat menu → Skills/CommandsSession Management
Pi sessions are stored locally and support tree-based navigation:
- Fork: Branch from any message to explore alternatives
- Navigate: Move between branches in the session sidebar
- Compact: Auto or manual context compaction to stay within limits
- Export: Export sessions to HTML for sharing or archiving
Pi vs Other Backends
| Feature | Pi | Claude Code | OpenCode | Codex |
|---|---|---|---|---|
| Providers | Multi (any) | Anthropic only | 75+ providers | OpenAI only |
| Open Source | Yes | No | Yes | Yes |
| Extensions | Yes (plugin API) | Plugins | Plugins | Apps |
| Session Tree | Yes (fork/navigate) | No | No | No |
| HTML Export | Yes | No | No | No |
| MCP Support | No | Yes | Full | Yes |
| Sandbox | No | No | No | Yes (built-in) |
| Thinking Levels | Configurable | Presets | Variants | Reasoning effort |
Troubleshooting
# Install Pi globally
npm i -g @mariozechner/pi-coding-agent
# Verify installation
which pi
pi --versionPi needs at least one provider API key configured. Check your environment variables:
echo $ANTHROPIC_API_KEY
echo $OPENAI_API_KEY
echo $GOOGLE_GENERATIVE_AI_API_KEYUse the compact command from the chat menu, or enable auto-compaction in Pi settings. You can also fork the session to start fresh with a summary.
broski doctor --profile agents to verify Pi is correctly detected and configured.