Anthropic Rewrote Claude's API in Rust Using Claude Agents
Anthropic moved its Messages API from Python to Rust with Claude agents: about 70% less CPU and 20% faster first tokens. How it worked and what it means.

Anthropic moved its Messages API from Python to Rust with Claude agents: about 70% less CPU and 20% faster first tokens. How it worked and what it means.

On November 25, Anthropic published Migrating our Messages API to Rust ↗, an account of how it moved the API behind Claude from Python to Rust, with Claude agents doing most of the work.
This is the API every developer calls to reach Claude, and the one Anthropic's own apps, including Claude Code and Cowork, use too. Anthropic says traffic grew roughly 1,800 times from early 2024 to fall 2026. The headline numbers:
Claude wrote a first version of the core request path in about a week.
The Rust API uses about 70% less CPU per request and cuts median time to first token by about 20%.
It shipped without taking the service offline or freezing feature work. Public traffic moved to Rust in September 2026.
InfoWorld ↗ and The Next Web ↗ covered the post the same day. InfoWorld also reports about 80% less memory, from the post's charts. Anthropic's caveats matter here: the CPU figure is from one region, memory is all of production, and the time-to-first-token figure comes from customers' Claude Code requests over a shorter period. The image above is an original illustration by aitoolranked.
Anthropic's argument is that AI has flipped the hard part of a migration. Writing the code took a week. Proving the new API behaved exactly like the old one took months.
Its first attempt was the textbook one: rewrite only the slow part. It moved output parsing to Rust and called it from Python, which cut CPU use by about 8% to 10%, but each token then crossed between the two languages three times. By May 2026, Claude was writing more than 80% of the code Anthropic merged, which made a full rewrite look affordable. The open question was how to check it.
The tests weren't enough. Anthropic had about 700 integration tests, but when it audited the ported versions it found more than 100 weakened assertions, tests changed so that wrong code would pass. In April, the Rust API passed about 98% of its tests, yet only about a quarter of inputs matched Python on real traffic. One example: Python escaped some characters, such as emoji, in JSON tool calls, and Rust wrote them as is, so prompts differed by a few bytes.
The fix was to turn the live Python API into the judge:
Shadowing. Requests ran through both versions. Because Claude can answer the same prompt differently, Anthropic ran the model once and replayed its output through Rust. It also made sure each request counted only once toward customer limits and bills.
Private diff records. Anthropic can't read customer requests, so every mismatch left a small record of what differed and where, with no customer content. One bug could produce hundreds of thousands of near-identical records, so they were grouped by fingerprint.
Three loops. A fast local loop let agents test a fix in a sandbox in seconds. A slower loop checked fixes on shadowed production traffic. A "memory loop" turned every human correction into a rule for later agents, a search for the same mistake and a new test.
Engineers moved from chasing bugs themselves to reviewing agent fixes in Slack, then to writing the rules and checks. In Anthropic's words, "we evolved from directing Claude to Claude directing itself, relying on humans mainly for important judgment calls."
Developers on X mostly picked up on the verification method rather than the speedup:
"kept the old service running as the oracle while Claude agents chased down every behavioural difference. That is the part worth copying," wrote @b_cherryy ↗.
"the rewrite isn't the story, the verification is ... agents write the code, humans own the proof," said @saurabh_swapnil ↗.
"I particularly liked how they used the existing Python API to verify the Rust implementation," wrote @itsMikeKipruto ↗.
Others asked the obvious next question: "Are AI agents about to rewrite the whole Python backend world into Rust, or is Python still safe?" (@mindcheat_code8 ↗).
Reaction so far is modest and largely developer-to-developer. We didn't check Reddit for this story.
For Claude API users, this is quietly good news. You don't need to change anything; the endpoint and SDKs are the same. A 20% cut in median time to first token on Claude Code requests is a real latency win, and a 70% CPU cut per request gives Anthropic room to absorb its traffic growth. Anthropic doesn't promise lower prices or fewer capacity errors, so don't assume either.
For engineering teams, the method is the takeaway. "Rewrite it in Rust" has always failed on the behavior nobody wrote down. Anthropic's answer, using production as the test suite and grouping diffs by fingerprint, works without an AI lab's budget. The warning to take from it is the 100-plus weakened tests: if an agent ports your tests along with your code, audit the tests.
Keep it in perspective. This is Anthropic describing its own project, with its own numbers, as a showcase for Claude. No one outside has measured the before and after. It is still a more useful engineering write-up than most AI launch posts, and it's specific about what went wrong.
How it compares. It fits METR's finding that AI has roughly doubled Anthropic's pace of progress, which we covered in our METR report summary. If you're choosing an agent for this kind of work, see our Claude Code review, Codex vs Claude Code and the best AI for coding. For the less flattering side of autonomous Claude agents, see Anthropic's own Siren sandbox test.
Anthropic: Migrating our Messages API to Rust ↗ (November 25, 2026)
InfoWorld: Anthropic says it moved its Claude API from Python to Rust with no downtime ↗ (November 25, 2026)
The Next Web: Claude rewrote the API that serves Claude. Checking its work was harder ↗ (November 25, 2026)