Pi vs Claude Code: An 8x Smaller Prompt and a Third of the Cost on One Bug Fix
We gave Pi the billing bug Claude Code and OpenCode fixed in October, on the same Sonnet 5.5 model. Current Pi fixed it for a third of Claude Code's cost.
A post called "Goodbye Claude, hello Pi" passed 800 points on Hacker News on November 8. Pi is an open-source coding agent with a short system prompt and four default tools, and the post argues that makes it leaner than Claude Code. Does a smaller prompt actually cost less on real work?
On the bug from our OpenCode vs Claude Code test, it did. Current Pi fixed it, passed every hidden test, and cost a third of Claude Code's figure with the same model. The old Pi that npm still serves under its first package name cost half as much again, partly because it didn't cache the conversation.
How we tested: On November 12, 2026 we ran Pi on the billing bug from our October test, twice on the old 0.73.1 release and once on the current 1.5.2, with Claude Sonnet 5.5 through OpenRouter at high thinking, in a Docker container that could see only a copy of the repository. 8 hidden tests graded each fix. The Claude Code and OpenCode figures are from our October 15 runs on the same repository, task, tests and model.
What did one fix cost in each agent?
The task gives the agent two support tickets about usage landing on the wrong invoice, one a month-boundary bug and one a time-zone bug, and asks it to find the cause, fix it and add tests. The agent never sees the 8 hidden tests that grade the result.
| Per fix, Sonnet 5.5 | Pi 1.5.2 (1 run) | Pi 0.73.1 (2 runs) | OpenCode (3 runs) | Claude Code (3 runs) |
|---|---|---|---|---|
| Hidden tests passed | 8 of 8 | 8 of 8, both runs | 8 of 8, all runs | 8 of 8, all runs |
| Cost at list price | $0.039 | $0.066, $0.050 | $0.066, $0.082, $0.086 | $0.127, $0.115, $0.106 |
| Model requests | 4 | 5, 4 | 5, 6, 7 | 8, 7, 7 |
| First request | 2,268 tokens | 2,290 tokens | 3,700 tokens | 18,903 tokens |
| Last request | 6,477 tokens | 7,054 and 6,825 tokens | 12,226 to 14,154 tokens | 25,582 to 26,951 tokens |
| Output, thinking included | 2,212 tokens | 3,335 and 3,411 tokens | 4,000 to 5,173 tokens | 4,098 to 5,487 tokens |
| Tests it added | 2 | 4, 5 | 5, 4, 5 | 5, 6, 6 |
| Wall time | 17.8 s | 25.0 s each | 34.5 to 48.2 s | not comparable |
Current Pi's $0.039 is a single run, so treat it as a direction rather than an average. Our 20-cent budget for this test ran out before a second one. Claude Code's wall times don't compare, because its October runs shared the machine with two other sessions.
All of them fixed both parts. Pi 1.5.2 passed the account's time zone into the function that picks a period's events, compared timestamps against local midnight, and made the end of the period exclusive, then added 2 tests, one per ticket.
Prices are Anthropic's list prices for Sonnet 5.5: $2 per million input tokens, $10 output, $2.50 for a 5-minute cache write, $4 for a 1-hour write and $0.10 for a cache hit (checked November 12). OpenRouter's bill for the Pi 1.5.2 run matched Pi's own figure, $0.0393.
Where does Claude Code's extra cost go?
Into its prompt, mostly. Claude Code's first request on this task was 18,903 tokens: the task plus its system prompt and tool definitions. Pi's was 2,268.
That gap rides along on every turn. Claude Code made 7 or 8 model requests per fix and read 145,000 to 172,000 cached tokens over a run. Current Pi made 4 and read about 9,600. Cached tokens are cheap at $0.10 per million, but on a Claude subscription Claude Code writes its cache with the 1-hour lifetime, which Anthropic bills at twice the input price. With an API key it defaults to 5 minutes, and repriced that way its October runs come to about $0.096 a fix.
Claude Code ran on a Claude subscription in October, so its figure is its own list-price arithmetic for those runs, not an API bill.
What changed between Pi 0.73.1 and 1.5.2?
Pi 0.73.1 put its cache marker on its first 2,286 tokens (system prompt, tools and the task) and sent the rest of the conversation uncached until the last request. In its run 1 that was 10,126 input tokens at the full $2 rate. Pi 1.5.2 cached each turn as it went, and its whole run had 10 uncached input tokens. Pi's changelog lists a fix for this in 0.82.0: OpenRouter Anthropic cache breakpoints now "advance through tool results". 1.5.2 also reached Claude through OpenRouter's Anthropic Messages API, where 0.73.1 used Chat Completions.
The old version landed close to OpenCode ($0.058 against $0.078 on average), and the new one at half of OpenCode. Caching was the smaller part of that drop: the input side fell from $0.024 to $0.017 a fix, while output fell from about 3,370 tokens to 2,212, and the 1.5.2 run added 2 tests where the old runs added 4 and 5. Thinking and code are billed at $10 per million, and they made up 56% of current Pi's $0.039.
Check which package you install. npm install -g @mariozechner/pi-coding-agent still gives you 0.73.1 from May 2026, and npm marks that package deprecated. Current Pi is @earendil-works/pi-coding-agent.
What do you give up with Pi?
pi.dev lists what Pi leaves out on purpose:
- No permission prompts. Pi's bash tool runs whatever the model asks. Its advice is to run it in a container, which is what we did.
- No sub-agents and no plan mode. You build them with extensions or install a package.
MCP used to be on that list. Pi added built-in MCP in version 0.99.0, so current Pi has it.
Claude Code ships permissions, sub-agents, plan mode and hooks, plus its own subscription plans. On this task none of them changed the result. Its system prompt and tool definitions are what take its first request to 18,903 tokens.
Should you switch to Pi?
- Paying per token for agent work? Pi or OpenCode. Both fixed this bug for less than Claude Code on the same model. OpenCode gives you permission rules out of the box, and Pi needs a container instead.
- On a Claude subscription? Claude Code still makes sense. Its bigger prompt counts against your plan's limits rather than a bill, and our Claude Code limit test covers what burns those limits faster.
- Want the smallest, most hackable agent? Current Pi. Expect to build the pieces it leaves out.
Whatever agent you use, check that it caches the whole conversation, turn by turn. On this bug it cut Pi's input-side cost from $0.024 to $0.017 a fix. Our prompt caching comparison measured what caching saves on Claude, GPT and Gemini, and our Claude Code alternatives cover more options.
Running Pi on bigger tasks and seeing a different ratio? Tell us on X at @devtoolpicks.
Get honest tool comparisons in your inbox
Join 50+ indie hackers and solo developers who get new comparisons, pricing changes, and tool picks. No spam. Unsubscribe anytime.
Related Articles
OpenCode vs Claude Code: Same Sonnet 5.5 Fix, Fewer Tokens in OpenCode
Same model, same bug, nearly the same code. The bill differed by a third, and mo...
What Burns Your Claude Code Limit: Subagents Cost 2.6x, MCP Servers Almost Nothing
One bug fix, run again and again with one setting changed each time. Subagents m...
Best AI Coding Agent Security Tools for Indie Hackers in 2026
A Cursor agent deleted a production database in 9 seconds. Here is what actually...