Imagine handing a junior engineer the keys to the system that serves millions of people — and asking them to rebuild it in a language they have never used, while it is still running. Now imagine that engineer is an AI, and the system is the one that delivers the AI itself.
That is roughly what Anthropic did this year. On Tuesday, November 25, the company published a detailed account of how it moved its Messages API — the main route through which customers and its own apps reach Claude — from Python to Rust. Claude wrote much of the new code.
The result uses about 70 percent less CPU per request. The migration, which moved public traffic to Rust in September 2026, also cut memory use by about 80 percent and trimmed the median wait for the first token by about 20 percent.
Anthropic says it did all of this without ever taking the service offline or freezing new features. The story is less about Rust than about a shift in how software gets built. Writing the code, Anthropic says, is no longer the hard part.
Why Anthropic Needed the Rust Migration
Anthropic built the Messages API in 2023 as a simple Python forwarder: a request came in, and the API passed it to a model. At the time, that was enough. By late 2025, every request had to be validated, converted into a prompt, tokenised and screened by safety classifiers before a model ever saw it.
Meanwhile, traffic exploded. From early 2024 to the autumn of 2026, API traffic grew roughly 1,800 times, according to Anthropic. Python, the language of much of the company’s research code, was doing a job it was never designed for at that scale.
Rust, a language built for speed and safety, was the obvious answer. It uses far less CPU per request. The question was never whether to move. It was how to move a system that could not stop.
The First Attempt That Barely Moved the Needle
Anthropic’s first try was cautious. Engineers rewrote only the code that parses a model’s output in Rust and called it from Python. It worked, but barely: CPU use fell by only about 8 to 10 percent.
Worse, the hybrid design added complexity. Each token now crossed the boundary between Python and Rust three times, creating new sources of overhead. The gains did not justify the mess, so the team went back to the drawing board.
What changed the calculation was Claude itself. By May 2026, Anthropic says, Claude was writing more than 80 percent of the code the company merged. A full rewrite, once a months-long project, suddenly looked feasible.
Claude Wrote the New API in a Week
Claude wrote a first version of the API’s core request path in about a week. That sentence, buried in Anthropic’s account, is the one that will make most engineers stop and reread. The model rebuilt the road it drives on.
But writing code was the easy half of the job. The Rust version passed roughly 98 percent of its tests by April 2026 — and then, when tested on real requests, only about a quarter of its input-processing results matched the Python version.
The gap was not a surprise. Tests describe what engineers think a system should do. Production traffic describes what it actually does, including every edge case and quirk that users have come to rely on. The old system had three years of those quirks baked in.
The Real Problem: Proving the New Code Was Identical
Anthropic’s engineers put it plainly in their post: “Verification, not generation, had become the bottleneck.” Or, as they wrote elsewhere: “Now that the hard part is no longer writing new code, we need to build sufficient confidence that the new system behaves like the old one.”
The company had about 700 existing integration tests, but they were not enough. Many were incomplete, and others were coupled to the Python implementation itself — meaning some tests passed for the wrong reasons.
There was another problem. Claude replies nondeterministically to the same request, so the team could not simply compare answers. And the Python API kept changing throughout the migration, as new models shipped and features landed. Parity was a moving target.
Shadowing Production Traffic to Catch Every Difference
The solution was to turn the production API into a verifier. Anthropic ran the same real requests through both versions and compared what came out, using the live Python system as the definition of correct.
To handle the model’s nondeterminism, the team ran each model once and then replayed its output through the Python and Rust paths, so both sides processed identical text. Mismatches were grouped by likely cause and automatically assigned to Claude agents to fix.
The fixes ran through three loops. A fast inner loop let agents test ideas in a sandbox and propose fixes in under a second. A slower outer loop validated each fix against live traffic. A memory loop recorded mistakes and the engineers’ feedback as rules, so agents stopped repeating them.
Humans stayed in the loop. An agent’s fix only reached production traffic after an engineer approved it, and if the fix failed, the agent tried again. The system learned from every round.
The Results: 70% Less CPU, 20% Faster First Token
The numbers, measured on production traffic, are striking. The Rust API uses about 70 percent less CPU per request and about 80 percent less memory, while the median time to first token fell by about 20 percent on Claude Code traffic.
None of it required a maintenance window. Public traffic moved to Rust in September 2026, and feature development continued throughout — new models and features kept shipping on the Python side while the new system was verified.
For developers, the change is invisible. The API works the same way, only faster, and that invisibility was the point. Anthropic’s engineers note that users should notice nothing except slightly quicker first tokens — and, over time, lower costs, as the company spends less on compute for every request it serves.
The migration is part of a much bigger year for Anthropic. Claude Fable 5.2 arrived in November as the company’s fastest model yet, the Claude office suite took aim at Microsoft and Google, and Anthropic filed for a $1 trillion IPO. Underneath all of it, the API that serves Claude was quietly rebuilt.
What Comes Next
Anthropic’s engineers draw a broader lesson from the project: migrating production systems with AI agents is feasible, but only if verification is treated as the real work. The code is the cheap part now.
That lesson will travel. Every large company with a creaking Python service is watching the same numbers — 70 percent less CPU, no downtime — and asking whether its own AI can do the same.
Anthropic’s answer, according to Anthropic, is that it can, as long as the old system is kept around to check the new one’s homework. The model that writes the code still needs a teacher — and for now, the best teacher is the system it is replacing.



