Pi vs Claude Code: open, any-model agent or Anthropic's own
Pi 1.5 and Claude Code 2.1 compared: licence, models and Claude plans, permissions and sandbox, extensions, headless runs and sign-in on a server.
Pi is a small, MIT-licensed coding agent that runs any of 15-plus model providers, starts with four tools, never asks before it acts, and leaves sub-agents, plan mode and permission rules to extensions you add. Claude Code is Anthropic’s own closed-source agent: Claude models only, included with a Claude plan from $20 a month, with sub-agents, plan mode, hooks, plugins, an optional shell sandbox and a classifier-checked auto mode built in. Pick Pi if you want to choose the model and shape the agent yourself; pick Claude Code if you want Claude on your Claude plan, with the guardrails already there. As of November 18, 2026 (Pi 1.5.2, Claude Code 2.1.327), the plan is the deciding line for many: Claude Code is the client a Claude subscription is built for, and using that subscription from Pi is a question of Anthropic’s terms, set out below.
Side by side
Read from each maker’s docs and package registry on November 18, 2026:
| Pi 1.5.2 | Claude Code 2.1.327 | |
|---|---|---|
Source | Open source, MIT | Closed: “All rights reserved” |
Models | “15+ providers, hundreds of models”, local ones included | Claude only, from Anthropic, Bedrock, Google Cloud or Microsoft Foundry |
How you pay | Pi is free; you pay the provider, by key or by a plan such as ChatGPT or Copilot | A Claude plan from $20 a month, or an API key billed per token |
Asks before acting | Never, by design | Auto mode by default: a classifier reviews each action |
Sandbox | None built in; its docs say run it in a container or VM | A shell sandbox, off by default |
Sub-agents, plan mode | Not built in; extensions or packages | Both built in |
Extending it | TypeScript extensions, skills, packages, MCP | Skills, hooks, sub-agents, MCP, plugins that bundle them |
Instructions file | AGENTS.md or CLAUDE.md | CLAUDE.md, or AGENTS.md in its place |
Scripted runs | pi -p, a JSON event stream, an RPC mode | claude -p, JSON and stream-JSON output, the Agent SDK |
Install | pi.dev/install.sh, or npm with Node.js 22.19+ | claude.ai/install.sh, apt, dnf, apk, or npm |
Licence, and who you are trusting
Pi’s repository is MIT-licensed, and the coding agent is one package in a monorepo beside its model library (pi-ai), agent runtime and terminal interface; you can read, fork and patch all of it. Its README states the design: “Pi ships with powerful defaults but skips features like sub-agents and plan mode.” Claude Code’s licence file is one line: “© Anthropic PBC. All rights reserved. Use is subject to Anthropic’s Commercial Terms of Service.” Anthropic’s legal page adds that Free, Pro, Max and Ultra users are under the Consumer Terms and Team, Enterprise and API users under the Commercial Terms.
Models, plans and what it costs
This is the biggest difference. Pi talks to Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, xAI, OpenRouter, Ollama and more, by API key or by signing in. OpenAI’s Sign in with ChatGPT page lists Pi among its open-source integrations, and Pi’s own sign-in connects a ChatGPT account; the page’s general rule for apps is that “App usage counts toward your existing plan limits.” Pi itself costs nothing; the bill is whichever provider you point it at.
Claude Code runs Claude models and nothing else. Its gateway page is explicit that Anthropic “doesn’t support routing Claude Code to non-Claude models through any gateway.” It needs “a Pro, Max, Ultra, Team, Enterprise, or Console account”; the free plan does not include it. On Anthropic’s pricing page that is Pro at $20 a month billed monthly, Max at $100, Ultra at $200, and Team at $25 or $125 a seat, or an API key billed per token, or your organization’s Bedrock, Google Cloud or Foundry account. Which Claude plans include Claude Code has the limits.
Pi can run Claude too, and that is where care is needed:
- With an Anthropic API key, Pi bills per token to the key’s organization, like any other app. Since Pi 1.5.1 (November 9, 2026) its default Anthropic model is Claude Opus 5.5.
- With Pi’s own Claude sign-in, Pi 1.2.0 showed (the wording was not re-read in 1.5.2): “Anthropic subscription auth is active. Third-party harness usage draws from extra usage and is billed per token, not your Claude plan limits.”
- With its makers’ extension pi-claude-code, Pi hands Claude requests to your installed Claude Code. Its README says those “count against your Claude subscription’s usage quota and rate limits”, and opens its caveats with “The future of this extension is uncertain.”
Anthropic’s legal page says subscription sign-in is “designed to support ordinary use of Claude Code and other native Anthropic applications”, that “Anthropic does not permit third-party developers to offer Claude.ai login into their own applications”, and that it may enforce this “without prior notice.” Which side of that a given route falls on is Anthropic’s call; your Claude subscription in Hermes, Pi or OpenCode sets each route beside Anthropic’s sentences. If Claude on your Claude plan is the point, Claude Code is the route Anthropic supports.
Whether it asks before it acts
Pi does not. Its security guide opens “Treat model-generated commands and code as untrusted” and says Pi “does not ask for approval before every tool call.” There is no permission system to switch on; a confirmation step is an extension you write or install, and Pi’s extension docs list permission gates and path protection among the examples. What Pi does ask is whether to trust a project before loading its own settings, extensions, skills and MCP servers from .pi/. For where to run it, the guide calls a container, virtual machine or sandbox “usually the strongest practical option.”
Claude Code has a permission system with several modes. Since 2.1.283, auto mode is the starting mode for interactive sessions: everything runs, “with background safety checks” by a classifier. Manual mode asks before anything beyond reads, and bypassPermissions (--dangerously-skip-permissions) runs everything, which the docs reserve for “Isolated containers and VMs only.” On a server, note that on Linux and macOS Claude Code refuses to start in that mode when it runs as root or under sudo.
Claude Code also ships a shell sandbox, built on bubblewrap and socat on Linux, and “off by default”: /sandbox or sandbox.enabled turns it on. It limits writes to the project and sends network traffic through a proxy with an allow-list, but “covers shell commands only. File tools, MCP servers, and hooks run outside it,” and by default it still allows reading credential files. So neither agent is a boundary on its own: what limits a mistake is the account and the machine it runs on. The guide to running agents without prompts covers what each Claude Code mode stops.
Extending each
Pi’s extensions are “TypeScript modules that extend Pi’s behavior”: they can register tools the model calls, add commands, model providers and MCP servers, and subscribe to lifecycle events. That is how you add a plan mode or sub-agents if you want them. Skills follow the Agent Skills format, read from ~/.agents/skills/ and .agents/skills/ among other places, and packages bundle all of these (pi install). MCP servers are built in, added with pi mcp add to ~/.pi/agent/mcp.json, or .pi/mcp.json for a project; by default the model reaches them through codemode scripts rather than seeing every tool. The warning that comes with the power: an extension “runs inside the Pi process with the same operating-system permissions.” Pi’s extensions covers installing and vetting them.
Claude Code gives you more pieces with fixed shapes. Its extension overview lists skills (Agent Skills, in .claude/skills/), sub-agents that run in their own context, MCP servers with tool search on by default, and hooks, which “run your script, HTTP request, MCP tool call, prompt, or subagent” at lifecycle events whether or not Claude decides to; its advice is “Put guardrails in hooks.” Plugins bundle skills, hooks, sub-agents and MCP servers into one install, shared through marketplaces.
What carries between them: Claude Code reads AGENTS.md in place of CLAUDE.md, and Pi reads either; both use the Agent Skills format, though from different folders, so a skill moves by copying it; and Pi’s MCP page says to copy an existing mcpServers entry from Claude Code into Pi’s file rather than reading Claude Code’s. Pi’s own skill folders, and the example extension that adds sub-agents, are in Pi’s skills and subagents.
On a server: sign-in, scripts and installs
Signing in with no browser. Claude Code opens a browser on first run; where none opens, its authentication page says to press c to copy the login URL, open it elsewhere, and paste the code back at “Paste code here if prompted”. For runs nobody attends, claude setup-token prints a one-year token for CLAUDE_CODE_OAUTH_TOKEN, which “can only make model requests, so it can’t establish Remote Control sessions.” Pi signs in from the shell since 1.5.1, and its CLI reference gives the form below; --no-browser uses “the provider’s other sign-in method, such as a device code, for example over SSH,” and the command “requires an interactive terminal”, so it runs in your SSH session, not in a provisioning script. Signing Pi in on a server goes provider by provider.
pi auth login <provider> --no-browser # Pi
claude # Claude Code: first run signs in
claude setup-token # token for unattended runsCopiedCredentials land in ~/.pi/agent/auth.json for Pi and ~/.claude/.credentials.json (mode 0600) for Claude Code; either agent can read the other’s file if they run as the same user.
Scripted runs. Both have a one-shot mode. pi -p writes the final answer and exits, its JSON mode streams events, and the RPC mode takes commands on stdin from another program. claude -p does the same with --output-format json or stream-json, whose JSON includes an estimated total_cost_usd, and the Agent SDK wraps it for Python and TypeScript. The two treat an unattended project differently. Pi’s print, JSON and RPC modes “cannot show the built-in trust prompt”, and with the default setting they skip a project’s protected resources unless you pass --approve. Claude Code’s headless page warns the other way: “Without --bare, a -p session runs the hooks in a project’s .claude/settings.json and connects the servers in its .mcp.json, even in a folder you’ve never trusted.” --bare skips them, but it also ignores your subscription login and wants an API key. Since 2.1.302 a claude -p run starts in Manual mode, where a call that needs approval is denied unless something approves it, such as an allow rule or a permission hook, or you pass another --permission-mode; running Claude Code on a schedule sets that up.
Installing and updating. Pi installs with its own script or from npm, which needs Node.js 22.19 or newer, and pi update with no target updates Pi itself; installing Pi on Linux has the detail. Claude Code is a native binary; installed with Anthropic’s script it updates itself in the background, and Anthropic also publishes apt, dnf and apk repositories. Claude Code on Linux covers each, and Anthropic’s docs are firm on one point for the npm route: “Do NOT use sudo npm install -g”.
curl -fsSL https://pi.dev/install.sh | sh # Pi
curl -fsSL https://claude.ai/install.sh | bash # Claude CodeCopiedFrom a phone. Claude Code’s Remote Control drives a session running on the server from the Claude app or claude.ai/code; the setup token cannot start it. Pi has no remote interface; it is a terminal program you reach over SSH, in tmux so it keeps running when you disconnect.
Who each fits
- You pay for a Claude plan and want Claude: Claude Code. It is the client the plan’s limits are built around.
- You want more than one lab’s models, local models, or a ChatGPT or Copilot plan: Pi.
- You want an agent you can read, fork and change, with a small prompt and only the features you add: Pi.
- You want plan mode, sub-agents and enforced guardrails without building them: Claude Code, with hooks for rules that must hold every time.
- You want to steer it from your phone without an SSH app: Claude Code, through Remote Control.
- You will leave it working unattended: either, on a machine or container of its own. Pi will not stop to ask at all, and Claude Code only asks when you leave it a mode that does.
On whether either solves more with the same model, the evidence is thin: the only independent test found that runs both on one model, with Pi faster and the scores within each other’s margins, is summarised in the guide to Pi. For the same choice against another full-featured agent, see Pi vs OpenCode, Pi vs Codex and Codex vs Claude Code.