Pi is a free, open-source AI coding agent that runs AI models against your codebase.
It ships as a minimal harness with four built-in tools (read, write, edit, bash) and expands through TypeScript extensions, skills, prompt templates, and installable packages.
Pi coding agent is designed for developers who want full control over how their coding agent behaves.
It currently supports 15+ major AI providers, lets you switch models mid-session, branches session history like a Git tree, and exposes every layer of its internals for modification.
Features
- Runs on Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, Hugging Face, Kimi For Coding, MiniMax, OpenRouter, Ollama, and more, authenticated via API keys or OAuth.
- Accepts existing subscriptions from Anthropic Claude Pro/Max, OpenAI ChatGPT Plus/Pro (Codex), and GitHub Copilot.
- Allows you to switch models mid-session with
/modelorCtrl+L, and cycle a curated list withCtrl+P. - Stores sessions as JSONL trees so every branch is preserved in a single file.
- Loads project instructions at startup from
AGENTS.mdfiles found in the working directory, parent directories, and a global config path. - Compresses older messages automatically when approaching context limits, with compaction behavior customizable through extensions.
- Includes TypeScript extension API for registering tools, commands, keyboard shortcuts, event handlers, and custom TUI components.
- Supports on-demand skill packages following the Agent Skills standard, loaded manually with
/skill:nameor automatically based on task context. - Exports sessions to HTML with
/exportor to a shareable GitHub gist with/share. - Runs in four modes: interactive TUI, print/JSON for scripts, RPC over stdin/stdout for non-Node integrations, and an SDK for embedding in your own apps.
- Packages bundle extensions, skills, prompts, and themes for distribution via npm or git.
Best For
- Developers who prefer terminal-based coding workflows.
- Users who want an open-source AI coding agent.
- Developers who want custom tools, commands, or workflows.
- Teams that use project instruction files across repositories.
- Users who want model choice across several providers.
- Developers who want to package and share agent customizations.
- Advanced users who want SDK, RPC, or JSON event access.
Who Should Skip It
- Users who want a polished web app.
- Beginners who dislike terminal setup.
- Teams that need built-in enterprise controls.
- Developers who want native sub-agents by default.
- Users who want built-in plan mode.
- Users who want one provider and one fixed workflow.
- Non-technical users who need a simple chat interface.
Pi vs Claude Code
| Pi | Claude Code | |
|---|---|---|
| Best fit | Extensible, provider-agnostic terminal agent | Anthropic-native terminal coding agent |
| Free access | Free install; pay for model API or use existing subscription | Free install; requires Anthropic subscription or API key |
| Setup difficulty | npm install or one-line curl; API key or OAuth login | npm install; Anthropic account required |
| Provider support | 15+ providers and custom models | Anthropic models only |
| Customization | Full TypeScript extension API; packageable and shareable | Limited user-side customization |
| Sub-agents / plan mode | Not built in; buildable via extensions or packages | Supported natively |
| Session management | Tree-structured JSONL with branching and export | Linear sessions with standard history |
| Main limitation | Minimal defaults require extension work for advanced features | Single-provider lock-in |
Choose Pi if you want an AI coding agent you can extend, script, or embed, or if you need multi-provider model access in a single CLI.
Choose Claude Code if you are already inside the Anthropic ecosystem and want a production-ready agent with native Anthropic features and no extension overhead.
Setup
Install Pi with the one-line shell installer:
curl -fsSL https://pi.dev/install.sh | shOr install via npm:
npm install -g @earendil-works/pi-coding-agentAuthenticate with an API key:
export ANTHROPIC_API_KEY=sk-ant-...
piOr log in with an existing subscription:
pi
/loginType /login inside the interactive session and select your provider. Pi then loads with the default four tools (read, write, edit, bash) and you can start coding immediately.
Related Resources
- Pi Website: The official Pi product page.
- Pi Documentation: Read setup, provider, extension, package, and SDK details.
Alternatives
- 7 Best CLI AI Coding Agents: Compare Kimi Code CLI with other terminal AI coding agents.
- Qwen Code CLI: Use a terminal coding agent optimized for Qwen3-Coder models.
- Gemini CLI: Browse Gemini CLI tools, wrappers, and integrations.
- Claude Code: Browse Claude Code tools, plugins, skills, and guides.
- Claude Code Resource List: Explore Claude Code agents, skills, plugins, utilities, and alternatives.
- Kimi Code CLI: Open-Source AI Coding Agent with Skills & MCP Support
Pros
- Open source core.
- Free to install.
- 15+ model providers in one agent.
- Existing subscription support (Anthropic, OpenAI, Copilot).
- Full TypeScript extension API.
- Tree-structured session branching.
- Packageable and shareable extensions.
- SDK and RPC modes for programmatic use.
Cons
- Setup is heavier than GUI-based tools.
- Packages carry full system access risk.
- No web or mobile interface.
- Multi-provider power users only.
- Windows requires extra terminal configuration.
FAQs
Q: Is Pi free to use?
A: Pi itself is free and open source. You pay only for the underlying model API calls, or nothing at all if you use an existing Anthropic, OpenAI, or GitHub Copilot subscription via OAuth login.
Q: Can I use Pi without sending data to external APIs?
A: Yes, if you configure a local model provider such as Ollama. Pi supports custom providers via models.json, so traffic stays local once a local model backend is set up.
Q: Does Pi support plan mode or sub-agents?
A: Not by default. Pi’s philosophy is to expose the primitives and let users build those features themselves via TypeScript extensions or install third-party packages that implement them.
Q: How does Pi handle long sessions and context limits?
A: Pi auto-compacts older messages when approaching the context limit. Full session history stays in the JSONL file, but compacted messages are summarized rather than preserved verbatim. You can revisit uncompacted history via the /tree branch navigator.
Q: Is it safe to install third-party Pi packages?
A: Third-party packages run with full system access, including the ability to execute arbitrary code and run system commands. Pi’s own documentation recommends reviewing source code before installing any third-party package.










