Anthropic has 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. The company says the new system uses about 70 percent less CPU per request and cuts median time to first token by about 20 percent, with no downtime and no freeze on new features.
The post, published on 25 November 2026, is less about the language change than about how Anthropic proved the new version behaved like the old one. Claude wrote a first version of the core request path in about a week, Anthropic says. Checking that version against the live service took from April until public traffic switched to Rust in September 2026.
The Messages API was built in 2023 as a thin Python forwarder. By late 2025, every request had to be validated, turned into a prompt, tokenized and screened by safety classifiers before it reached a model. Traffic grew fast: from early 2024 to autumn 2026, API traffic grew roughly 1,800 times, Anthropic says. Python was using far more CPU per request than Rust would need for the same work.
Why a partial fix was not enough
Anthropic first tried a smaller change. It rewrote the code that parses a model output in Rust and called it from Python. That cut CPU use by about 8 to 10 percent, but each token then crossed between Python and Rust three times, which added complexity without enough gain.
A full rewrite had long looked too costly. That changed as Claude improved. By May 2026, Anthropic says, Claude was writing more than 80 percent of the code the company merged. Writing the Rust code was no longer the main cost. The main cost was being sure the new code did exactly what the old code did, including edge cases that users rely on and that no test suite fully describes.
Anthropic lists three ways to define correct behaviour: fixed rules, examples in a test suite, or the existing production system as a reference. It chose the third. The team turned the live Python API into a verifier for the Rust version, running the same production traffic through both and comparing the results.
The test that exposed the gap
In April, the Rust version passed about 98 percent of its roughly 700 integration tests. Yet when Anthropic ran it on real production traffic, only about a quarter of inputs produced an identical prompt. That gap, Anthropic says, is the point of the post: tests can pass while real behaviour still differs, because live traffic includes quirks that tests do not cover.
The team built loops around that comparison. It shadowed live traffic, compared checkpoints at each stage, and used fingerprints to sort mismatches. When a difference appeared, Claude agents were sent to fix it, with engineers reviewing the changes. The post describes inner and outer loops, plus a memory loop that turned repeated review comments into rules in the project file, so the same mistake did not return.
One design choice made the comparison possible. Anthropic ran the model once, then replayed its output through the Python and Rust paths, so differences in the API code could not be confused with differences in what the model generated. That let the team isolate the API itself.
What changed for users
For developers who call the API, the visible change is speed and efficiency rather than a new interface. Anthropic reports about 70 percent less CPU per request, more than 80 percent less memory per request across the service, and about 20 percent lower median time to first token on the Claude Code traffic it charted. The company says the migration happened without taking the service offline or freezing feature work on the Python version.
Anthropic is careful about what the post does not prove. It gives no figures for the agent compute spent, the number of agent written pull requests or the engineering hours involved, and the Rust code is not public. The lesson the company draws is narrower: as AI models get better at writing code, the hard part of a large migration shifts from writing the code to checking that it behaves the same.
For teams planning a similar move, the post offers a practical checklist. Keep the old system running as the reference, compare on real traffic rather than tests alone, fix differences in small loops, and write the lessons down so agents and engineers do not repeat them. The code may take a week. Trust, in this case, took five months.




