I use both of these tools every day.
Claude Code for work. Pi when I want control. And sometimes both in the same session on the same project.
Most comparisons treat this as an either/or decision. It's not. They solve different problems. But there's a reason I keep coming back to both, and a reason I hit a wall with each one.
Here's what actually happened when I tried to make Pi my daily driver. And why Claude Code keeps pulling me back.
TL;DR
At a glance: Pi is open-source (MIT-licensed), 44K+ GitHub stars (May 2026), supports 15+ LLM providers, ships a ~1,000-token system prompt, and includes 4 built-in tools (read, write, edit, bash). Claude Code is proprietary, locked to Anthropic's Claude family, ships a ~14,000-token system prompt, includes 10+ built-in tools (sub-agents, MCP, web search), and runs as a terminal CLI, a VS Code extension (2M+ installs as of May 2026), and a desktop app.
Pi is the better choice if you want full control over your agent, use multiple LLM providers, and you're comfortable building your own workflows. Claude Code is the better choice if you want something that works immediately with Claude models across terminal, IDE, and desktop.
Most experienced developers should use both.
| Feature | Pi | Claude Code |
|---|---|---|
| Philosophy | Minimal harness, you build what you need | Batteries-included, works out of the box |
| License | MIT | Proprietary |
| GitHub Stars | 44K+ (May 2026) | N/A (proprietary distribution) |
| Model support | 15+ providers, hundreds of models | Claude family (Sonnet, Opus, Haiku) |
| System prompt | ~1,000 tokens | ~14,000 tokens |
| Built-in tools | 4 (read, write, edit, bash) | 10+ (including sub-agents, web search, MCP) |
| MCP support | Not built-in (add via extension) | Native |
| Extensibility | TypeScript extensions, Skills, packages | Plugins, MCP servers, hooks |
| Interface | Terminal only (TUI) | Terminal, VS Code, Desktop app |
| Pricing | Free tool + your own API costs | Pro ($20/mo), Max, Team, Enterprise |
| Best for | Power users, multi-model setups, budget control | Teams, Claude-first developers, quick setup |
What Pi Taught Me About My Own Workflow
I came to Pi from running two Claude Code subscriptions. One personal, one through Popp (the AI recruitment startup I work at). Plus a Cursor subscription.
That's three harnesses. Three sets of muscle memory. Three monthly charges.
Pi looked like the answer. Open source. Model agnostic. A system prompt under 1,000 tokens instead of Claude Code's 14,000. Total control over the harness.
So I set it up and started scaffolding create-sbastack-app with it.
Within the first hour I blew through my Z.ai cap. Four million tokens, gone. Switched to OpenAI Codex. Hit the 5-hour cap after two hours of intense coding.
I posted about it on Reddit. The thread got 16K views and 49 comments (as of May 2026). The community response was split down the middle. Half the people said "I don't understand how people run out of tokens like that." The other half said "dude, I have the same issue."
Turns out I was doing everything wrong.
Pi Exposes What Claude Code Hides
Here's the thing nobody tells you about switching from Claude Code to Pi.
Claude Code's 14,000-token system prompt isn't just bloat. It's a safety net. It silently handles context management, compaction, file reading strategies, and a dozen other things you never think about. When your AGENTS.md or CLAUDE.md file is poorly written, Claude Code absorbs it. The big prompt drops stuff. It compensates.
Pi doesn't do that.
Pi has four tools. Read, write, edit, bash. A system prompt under 1,000 tokens. And it sends everything you give it straight to the model.
So when I ported over my CLAUDE.md with all my skills, my MCPs, my planning workflows from Matt Pocock's skills package, Pi faithfully loaded all of it. Every token. Every instruction.
And it burned through my caps in an hour.
Pi is a mirror. It reflects your workflow back at you with zero filter. Every inefficiency, every bloated instruction file, every habit you picked up from a harness that was compensating for you. All visible.
That's Pi's superpower. That's also why the learning curve is steep.
What Is Pi? What Is Claude Code?
In short: Pi is an open-source, MIT-licensed terminal coding agent created by Mario Zechner with 44K+ GitHub stars (as of May 2026). It ships with four core tools (read, write, edit, bash) and supports 15+ LLM providers including Anthropic, OpenAI, Google, and local models via Ollama. Its system prompt is approximately 1,000 tokens. Claude Code is Anthropic's proprietary agentic coding tool, launched May 2025, with a ~14,000-token system prompt, 10+ built-in tools, and three interfaces (terminal CLI, VS Code extension with 2M+ installs, desktop app). It supports only the Claude model family.
Pi: The Minimal Coding Harness
Pi is an open-source terminal coding agent created by Mario Zechner. 44K+ GitHub stars (as of May 2026). The core ships with exactly four tools: read, write, edit, and bash.
Everything else is opt-in. Sub-agents, MCP support, planning modes. Build it yourself through extensions, or install a community package.
Pi's position is that models are already trained to be coding agents. They don't need a 14,000-token system prompt explaining what a coding agent is. The result is a tool where nearly 100% of the context window goes to your actual work.
It supports over 15 LLM providers. Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, Hugging Face, and more. Switch models mid-session with /model or Ctrl+L. Use Ctrl+P to cycle through favourites.
Claude Code: The Integrated Coding Agent
Claude Code is Anthropic's agentic coding tool. Launched May 2025. Frequent releases. Growing plugin ecosystem.
It ships with sub-agents for parallel research, native MCP support, automatic memory that persists between sessions, path-scoped rules for monorepos, and a visual context window timeline.
Available as a terminal CLI, a VS Code extension (2M+ installs as of May 2026), and a standalone desktop app. Primarily supports the Claude model family including 1-million-token context variants.
I use it 100% for work and I love it. I don't worry about cost or caps. It just works.
That last sentence is both its greatest strength and its biggest risk.
Which tool supports more AI models?
In short: Pi supports 15+ LLM providers and hundreds of models, including Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, Hugging Face, and local models via Ollama. You can switch mid-session. Claude Code supports only the Claude family (Sonnet, Opus, Haiku) plus their 1M-token context variants. As of April 2026, Anthropic also blocks Claude subscription inference through third-party agents, using Claude through Pi means paying API rates on top of your Claude subscription.
This is where most people should start. It's the sharpest difference between the two tools.
Pi: Any Model, Any Provider
Pi is fully model-agnostic. Hundreds of models across 15+ providers. Switch mid-session. Use GPT-5.5 for one task, Claude Sonnet for another, fall back to a local model through Ollama when you want to work offline.
No other major coding agent offers this level of model freedom.
From my Reddit thread, the community has figured out creative stacking strategies. One commenter runs MiniMax with Pi on a $10 subscription. 1,500 requests every 5 hours, no monthly cap. Another uses the OpenAI 5x Pro plan running multiple parallel GPT-5.5 agents all day and never hits limits. He credits Pi's minimal system prompt for the efficiency.
The local model crowd is thriving too. Multiple people running Qwen 3.6 on 64GB M4 Pro Macs with zero caps.
Claude Code: Deep Integration, Hard Lock-In
Claude Code supports the Anthropic Claude model family. Sonnet, Opus, Haiku. For supported accounts, 1M-token context variants are available.
The integration is genuinely good. The subscription bundles everything at a predictable cost. The models are excellent for coding tasks.
But here's the problem.
The Lock-In Problem Nobody Wants to Talk About
On April 4, 2026, Anthropic stopped allowing third-party agents to use Claude subscription OAuth tokens for inference.
If you want to use Claude models through Pi, you pay API rates. A developer on Claude Max who also wants to use Pi with Claude models is paying twice. I dug into the broader pricing shift in Claude Code pricing 2026: autonomous credits explained, same dynamic, different surface.
But it got worse.
Later in April 2026, an "overactive anti-abuse system" (Anthropic's own words, via Boris Cherny, head of Claude Code) was scanning git history for strings associated with competing harnesses. If Claude Code saw the exact string HERMES.md (case-sensitive) in your commit messages, it silently routed your session from subscription billing to extra-usage billing. No notification. No confirmation.
One user reportedly burned $200.98 in extra usage while 86% of his Max 20x plan sat untouched. The trigger was a string in a commit message. He wasn't even using Hermes. The full incident is documented in GitHub issue #53262 on the Claude Code repo, with a detailed writeup at thekavin.com.
Theo Brown ran his own tests and called it out in "Seriously, Anthropic??" on May 1, 2026. The story climbed Hacker News (1,100+ points) and Reddit before Anthropic responded.
To Anthropic's credit, they fixed it. Affected users got full refunds plus an extra month of credits. Boris Cherny publicly attributed the bug to the anti-abuse heuristics rather than deliberate billing-tier policy. As of this writing, the specific HERMES.md trigger is no longer active.
But the precedent is what matters. The fact that this code path existed at all, that a string in your git history could silently change your billing tier, tells you something about where the incentives sit. The OAuth block from April 4 is still in place. The harness-detection logic isn't going away as a category, even if this specific bug was patched.
Pi doesn't have this problem. Pi doesn't care what's in your git history. It's a harness. You point it at a model, it calls the API, end of story.
How Each Tool Understands Your Code
In short: Pi loads AGENTS.md files at startup (global, parent, project) and reads files on demand with its four core tools, no pre-indexing, no RAG. Claude Code auto-loads CLAUDE.md, an auto-generated MEMORY.md, environment info, and runs sub-agents in separate contexts. Pi's ~1,000-token system prompt leaves nearly 100% of the context window for your work; Claude Code's ~14,000-token system prompt consumes roughly 7% of a 200K-token budget before you type anything.
Context Loading
Pi loads AGENTS.md files at startup. Global, parent directory, or project level. You can replace or extend the system prompt with SYSTEM.md or APPEND_SYSTEM.md. Beyond that, Pi reads files on demand with its four core tools. No pre-indexing. No RAG pipeline.
Claude Code automatically loads global instructions, project CLAUDE.md, auto-generated MEMORY.md, and environment info. Sub-agents handle heavy research in separate contexts. Path-scoped rules fire automatically in monorepos.
Context Window: Where Pi Forces You to Be Better
Pi's compaction system auto-summarizes when you approach the context limit. Fully customisable through extensions. One popular extension (pi-observational-memory) lets you set aggressive compaction at 40K tokens, dramatically reducing live context and usage.
Claude Code gives you a visual timeline of context consumption and a /compact command.
The real difference is overhead.
Pi's system prompt: ~1,000 tokens. Nearly everything goes to your work.
Claude Code's system prompt: ~14,000 tokens plus safety instructions, tool definitions, and formatting rules. On a 200K context model, that's roughly 7% of your budget consumed before you type anything.
When I was burning through Z.ai caps with Pi, I thought the tool was the problem. It wasn't. My AGENTS.md was bloated. My skills were loading unnecessary context. I was used to Claude Code absorbing that waste silently.
The commenter who nailed it on my Reddit post:
Extensibility: Build It vs Ship It
In short: Pi extensions are TypeScript modules with full access to tools, commands, keyboard shortcuts, events, and the TUI, you can replace the entire UI or override any tool. MCP isn't built-in; Pi's docs argue most MCP functionality can be replicated with Skills (CLI tools with descriptive READMEs). Claude Code makes MCP first-class and built-in, ships a plugin marketplace, supports hooks on agent events, and uses CLAUDE.md for project instructions, but you can't fundamentally change how the agent works.
Pi: Higher Ceiling, Higher Floor
Pi's extensions are TypeScript modules with full access to tools, commands, keyboard shortcuts, events, and the TUI. You can replace the entire UI, override any tool, inject custom system prompts per-turn.
Pi intentionally doesn't ship MCP support. The official docs link to a blog post titled "What if you don't need MCP?" and suggest building an extension if you do. Philosophical choice. Most MCP functionality can be replicated with Skills (CLI tools with descriptive READMEs).
The package ecosystem is growing fast. Community packages for sub-agents, observational memory, context guards, Caveman mode for stripped-down token usage. One dev in my thread built a "Codex Runner" that generates a campaign of atomic coding tasks and executes them with validation receipts.
Claude Code: Lower Floor, Lower Ceiling
MCP is first-class and built-in. Plugin marketplace exists. Hooks let you run shell commands on agent events. CLAUDE.md files handle project instructions.
It works well immediately. MCP, sub-agents, and plugins cover most needs. But you can't fundamentally change how the agent works.
Which Approach Is Better?
If you invest the time, Pi gives you a perfectly tailored workflow no pre-built tool can match.
Claude Code gives you 80% of what you need in 10 minutes.
I've personally found myself reaching for Claude Code and Cursor when I need something done fast. The muscle memory is there. I know what to expect. Pi makes me think harder about every interaction, which produces better results but takes longer to get there.
How much do Pi and Claude Code cost?
In short: Pi is free and MIT-licensed; you only pay for whatever LLM provider you connect, so monthly cost ranges from $0 (local models) to $300-$600+ (heavy pay-per-token API use). Claude Code requires a paid Anthropic subscription starting at Pro ($20/month, sufficient for most solo developers coding 2-4 hours daily). Claude-first developers typically pay less on Claude Code Pro than running Claude through Pi via API. Multi-provider users pay less on Pi.
Pi
Free tool. MIT licensed. You pay for whatever LLM provider you connect.
Your actual cost depends entirely on your model choices and how clean your context management is. People in my Reddit thread reported wildly different experiences. One person spends $300-600/month paying by the token. Another uses the OpenAI 5x Pro plan and never hits limits. Several run local models and pay nothing beyond electricity.
Claude Code
Requires a paid Anthropic subscription. Pro at $20/month is the entry point.
For solo developers coding 2-4 hours daily, Pro is usually sufficient. Heavy users may need Max.
Worth noting: Anthropic briefly tested removing Claude Code from the Pro plan in early April 2026, then restored it on April 26, 2026 after backlash. It's currently included as of May 2026, but that signal matters. Check current plan entitlements before committing, and if you're tracking the broader pricing changes, see Claude Code pricing 2026: autonomous credits explained.
The Real Comparison
If you're Claude-first, Claude Code on Pro ($20/month) is almost certainly cheaper than using Claude through Pi via API.
If you use multiple providers or primarily GPT/DeepSeek/open-weight models, Pi is cheaper. The tool is free.
If you want both (which I do), you're looking at $20/month for Claude Code plus whatever API costs or subscriptions you run through Pi.
My personal setup: Claude Code with Max for work at Popp. Pi with Codex for personal projects and experimentation. I'm still figuring out the right balance.
What is Pi's session tree feature?
In short: Pi's session tree turns your conversation into a branchable structure instead of a linear log. Use /tree to see every branch, and /fork to spawn a new branch from any earlier message. If the agent went off the rails ten messages ago, you jump back to that point and continue without losing context. No other major coding agent ships this, it's the single most underrated Pi feature.
This doesn't get enough attention.
Most coding agents give you a linear conversation. Pi gives you a tree. Use /tree to see the full branch structure. Use /fork to create a new branch from any earlier message.
If the agent went wrong ten messages ago, jump back to that point and continue. No context loss. No restart.
This alone is worth trying Pi for. Every agent should have this.
When to Use Each
Reach for Pi when
You use multiple LLM providers
Switching mid-session is a first-class feature nobody else offers.
You want to understand your own workflow
Pi forces you to write clean instructions, manage context deliberately, and stop relying on a harness to compensate for sloppy prompting.
You're cost-sensitive and don't primarily use Claude
Free tool plus API costs wins on price.
You're building custom agent workflows
Extensions, RPC mode, and SDK mode make Pi a platform, not just a chat interface.
Reach for Claude Code when
You primarily use Claude models
Best integration. Predictable monthly cost.
You want it to work now
Minimal setup. Sub-agents, MCP, memory, context management, all out of the box.
You work on a team
Settings files, model pinning, plugin ecosystem, team features.
You need MCP integrations
First-class, native, no extension required.
You want terminal + IDE + desktop
Claude Code covers all three. Pi is terminal only.
The Verdict
Use both.
That's not a cop-out, it's what I actually do. Claude Code is my daily driver for work at Popp. I know the shortcuts, I know the quirks, I trust it for production code. Pi is my lab. When I want to test a different model on a problem, maximise context efficiency, audit why my AGENTS.md is producing bad results, or build something custom, I reach for Pi.
Pi's creator built Pi after using Claude Code extensively. He didn't build it to replace Claude Code. He built it to control the parts a proprietary tool can't give you.
Which brings me back to the harness-detection incident. Anthropic shipped, then patched, a system that silently changed billing based on strings in your git history; users were refunded and Boris Cherny was straight about it. Right outcome, but the lesson stands.
When you don't control the harness, somebody else's anti-abuse heuristic decides what your subscription actually buys. That's why Pi exists, and why the independence has value even if you never switch away. If you're forced to pick one, pick on whether you want control or convenience: Pi bets on user control and pays in setup time; Claude Code bets on integration and pays in lock-in. The underlying philosophies aren't going to converge.
If you're not forced to pick and most experienced developers aren't, run both. $20/month for Claude Code Pro plus whatever you spend through Pi is cheap insurance against any single vendor changing the rules on you.
Frequently asked questions
- Is Pi open source?
- Yes. Pi is open source under the MIT license, created by Mario Zechner with 44K+ GitHub stars as of May 2026. The full source is on GitHub, the four core tools (read, write, edit, bash) are public, and you can fork or extend any part of the agent. There is no proprietary core, no telemetry-by-default, and no paid tier of the tool itself.
- Can Pi use Claude models?
- Yes, but at API rates. Pi supports Anthropic Claude (Sonnet, Opus, Haiku) alongside 14+ other providers, switchable mid-session. As of April 2026, however, Anthropic blocks Claude subscription inference through third-party agents, so a Claude Max subscriber using Pi with Claude pays twice, once for the subscription, once per token through the API.
- How much does Claude Code cost?
- Claude Code requires a paid Anthropic subscription. The Pro plan at $20/month is the entry point and is usually sufficient for solo developers coding two to four hours daily. Heavier users move to the Max plan or Team/Enterprise tiers. Anthropic briefly tested removing Claude Code from Pro in early April 2026 and restored it on April 26 after backlash, so check current entitlements before committing.
- What models does Pi support?
- Pi supports 15+ LLM providers and hundreds of models. The list includes Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, and Hugging Face, plus local models via Ollama. You switch mid-session with `/model` or `Ctrl+L` and cycle favourites with `Ctrl+P`. No other major coding agent offers this level of model freedom.
- Can I use Pi and Claude Code together?
- Yes, and most experienced developers should. Run Claude Code as your default for fast Claude-backed work and use Pi as a lab for multi-provider experiments, custom extensions, and aggressive context optimisation. They install side by side, share no state, and don't conflict. Cost is your $20/month Claude Code Pro plan plus whatever you spend through Pi.
- What is Pi's session tree feature?
- Pi's session tree turns conversations into a branchable structure instead of a linear log. The `/tree` command shows every branch and `/fork` spawns a new branch from any earlier message. If the agent went off the rails ten messages back, you jump to that point and continue without losing context. No other major coding agent ships this.
- Is Claude Code free?
- No. Claude Code requires a paid Anthropic subscription, starting at the $20/month Pro plan. There is no permanently free tier. Pi, by contrast, is free under MIT, you only pay for the LLM provider you connect, which can be $0 if you run local models through Ollama. Claude Code's value comes from bundling subscription access at a predictable monthly cost.
Start by doing this
5 mins: Install Pi (npm install -g @mariozechner/pi-coding-agent) and run it in a project directory. See what your AGENTS.md looks like through a minimal harness.
15 mins: Read my Reddit thread on optimising Pi usage. Real developers sharing real configurations. If you want the broader story on how Anthropic's pricing has been moving, Claude Code pricing 2026: autonomous credits explained covers the latest shift.
30 mins: Try running the same task in both Pi and Claude Code. Notice what each one does differently with your instructions.