Anthropic Migrates Bun's 1M Lines of Zig to Rust in 11 Days for $165k: The Real Cost Breakdown
By Eric Bush · July 17, 2026 · 8 min read
The $165k Migration That Reset Expectations
Anthropic published a case study on July 16, 2026 describing how Jarred Sumner, creator of the Bun JavaScript runtime, used Claude Fable 5 to migrate roughly 535,000 lines of Zig into Rust in 11 days. Total Anthropic API bill: about $165,000. Sumner orchestrated 64 parallel agents through Claude Code, each handling a slice of the codebase with tests as verification gates.
On its face this is a marketing story for Fable 5. But the numbers tell a more useful story for anyone budgeting AI-assisted work: cost per line, cost per parallel agent-hour, and the specific conditions that made this project tractable.
Unit Economics of the Migration
The reported numbers break down to about $0.31 per line of source migrated. That's below what a mid-level engineer costs even in low-cost regions, and it's an order of magnitude below what traditional consultancies quote for language migrations ($3-$8 per line historically). But three things made this possible: existing tests, an owner with deep architectural knowledge, and a model priced for the workload.
| Metric | Value |
|---|---|
| Source lines migrated | ~535,000 |
| Total API spend | ~$165,000 |
| Cost per line of code | ~$0.31 |
| Wall clock time | 11 days |
| Parallel agents | 64 |
| Avg agent-hours per day | ~1,536 |
Model Choice: Fable 5 vs the Alternatives
Fable 5 sits at $10 input and $50 output per million tokens. That's expensive per token, but the case study makes clear the value was in reducing retry loops — Fable 5's higher first-pass correctness meant fewer wasted agent runs, and 64 parallel agents amplify any per-run efficiency gain. Here is what the same migration would have cost using different frontier models, assuming rough parity in per-line efficiency (which is optimistic for cheaper models):
| Model | Input $/M | Output $/M | Naive scaled cost |
|---|---|---|---|
| Claude Fable 5 (actual) | $10 | $50 | $165k |
| GPT-5.5 Pro | $30 | $180 | $530k |
| GPT-5.6 Sol | $5 | $30 | $95k |
| Claude Opus 4.8 | $5 | $25 | $82k |
| Gemini 2.5 Pro | $1.25 | $10 | $28k |
| DeepSeek V4 Pro | $0.435 | $0.87 | $3.5k |
The "naive scaled cost" column is what you'd pay if token counts held constant across models — which they never do. Cheaper models typically require 2-4x more retry loops for the same first-pass correctness on a task this complex, which erodes the paper savings quickly. The DeepSeek V4 Pro number at $3.5k looks tempting but assumes zero rework, which is unrealistic for a 535k-line Zig-to-Rust migration.
What Made This Migration Cheap
Three preconditions made $0.31 per line achievable, and if your project is missing any of them your actual cost will look nothing like Sumner's:
1. Extensive existing test coverage. Bun's tests acted as the acceptance oracle for each migrated slice. Without that, human review time would have dominated and blown the budget past 5-10x.
2. An owner with architectural clarity. Sumner knows Bun end-to-end. He wrote the original Zig. That let him decompose the work into 64 independently verifiable slices — a task the AI itself would have struggled with cold.
3. Static, well-defined transformation. Zig-to-Rust is a mechanical rewrite of memory management patterns, not a redesign. Migrations that change architecture — say, monolith to microservices — do not exhibit this economics.
Should You Copy This Playbook?
For a language migration on a codebase with strong tests and an engaged owner, yes. Budget $0.30-$1.00 per line of source depending on complexity and add 25-40% buffer for review overhead. For architectural rewrites, greenfield features, or anything requiring new design decisions, this economic model does not transfer.
Use our AI cost estimator with Fable 5 or Opus 4.8 as the model and "large refactor" as the project type to model your own migration. Compare against DeepSeek V4 Pro and Kimi K2.7-Code — those two are increasingly the smart mid-tier choices for teams that can tolerate slightly more retries in exchange for a 10-20x lower per-token cost.
Want to calculate exact costs for your project?
Frequently Asked Questions
How was Anthropic's $165k Bun migration cost calculated?
The total is API spend across roughly 11 days of orchestration involving 64 parallel Claude Fable 5 agents in Claude Code. It excludes Jarred Sumner's time, tooling development, and post-migration review. Cost per line of source code works out to roughly $0.31, but that number depends heavily on the existing tests as the verification oracle.
Can I replicate the Bun migration approach with a cheaper model?
For simpler codebases with strong test coverage, yes — models like DeepSeek V4 Pro at $0.435/$0.87 per million tokens or Kimi K2.7-Code at $0.74/$3.50 can approach Fable 5 economics if you accept 2-3x more retry loops. For projects requiring high first-pass correctness on complex code, the per-token savings often disappear once retries are counted.
Why did Bun use 64 parallel agents instead of one?
Language migrations decompose naturally into independently verifiable slices — each file or module can be migrated and tested in isolation. Running 64 agents in parallel compressed 11 days of wall clock time down from what would otherwise have been months of sequential work. This pattern only works when the task decomposes cleanly, which is rare outside of migrations and bulk transformations.
What kinds of projects are NOT suited to this migration pattern?
Architectural rewrites, greenfield feature work, and any task requiring new design decisions or product judgment. The Bun case worked because Zig-to-Rust is a mechanical transformation with tests as acceptance criteria. Once you introduce ambiguity about what the target should look like, the per-agent efficiency collapses.
How much should I budget for a similar 100k line migration?
For a similar mechanical language migration with existing test coverage, budget $30k-$100k using Fable 5 or Opus 4.8. Cheaper models like DeepSeek V4 Pro can bring that to $8k-$25k with more oversight. Add 25-40% buffer for human review and integration work — the API spend is usually 60-70% of total project cost.
Related Articles
Lindy Switched 100% From Claude to DeepSeek — A Real Migration Cost Breakdown
San Francisco AI startup Lindy moved 100% of inference from Claude to DeepSeek in June 2026, citing AI bills 'higher than employee salaries.' We pull apart the math: when migration pays off, what the hidden switching costs are, and the decision framework for other teams.
YC CEO's 37,000 Lines of Daily AI Code Exposed: Why More Lines Means Higher Real Costs
Garry Tan claimed 37K lines per day with AI coding tools. Community review found bloated, low-quality frontend code. We analyze the hidden costs of AI code volume — review time, refactoring, and technical debt.
AI Code Translation Cost: Python → Rust, JavaScript → TypeScript, Java → Go Per 1K Lines (2026)
Porting code between languages with AI looks fast until you hit edge cases. We measure actual token cost per 1K lines of translation across Claude, GPT, and DeepSeek, plus the multi-pass review tax that makes the output usable.