By Hamza Faisal
Anthropic has revealed how it moved the Messages API — the gateway every Claude request passes through — from Python to Rust, and it let Claude do much of the rewriting. The result: about 70 per cent less CPU per request, more than 80 per cent less memory, and first tokens arriving about 20 per cent faster — all without taking the service offline or freezing new features.
The engineering post, published on November 25, describes a migration that sounds simple and was anything but. The Messages API, built in 2023 as a thin Python request forwarder, had grown enormously: traffic through it rose roughly 1,800 times between early 2024 and the autumn of 2026, as Claude Code, Cowork and outside developers all piled on. Python, the company said, had become the bottleneck.
Claude wrote the new code in about a week
The first version of the core request path took Claude about a week to write. By May 2026, Claude was writing more than 80 per cent of the code Anthropic merged across the company, so the cost of attempting a full rewrite had fallen sharply. An earlier, smaller attempt — rewriting only the output-parsing code in Rust — had cut CPU use by just 8 to 10 per cent while making every token cross between the two languages three times. The team went for the full migration instead.
Testing it was the hard part. The Python API kept changing as new models and features shipped, so "correct" was a moving target. Claude's replies are nondeterministic, so two different outputs did not necessarily mean a bug. And because Anthropic could not read customer requests, the team could not easily see where the two versions diverged.
The live API became its own test
The solution was to turn the production API into a verifier. Anthropic ran each model output once, then replayed it through both the Python and Rust versions of the request path and compared the results. Differences were traced to exact points in the code with checkpoints, and "fingerprints" helped tell one bug from another. Claude agents then worked in nested loops — a fast local loop testing hypotheses in seconds, a slower loop checking fixes against shadowed production traffic, and a prose memory of corrections shared across the team — until the two versions agreed.
By April 2026 the Rust version passed about 98 per cent of its integration tests, but only about a quarter of real production inputs matched Python at first. Months of agent-driven fixes closed that gap, and public traffic moved fully to Rust in September 2026.
What changed for developers
For developers building on the Claude platform, the payoff is a faster, cheaper serving layer: roughly 70 per cent less CPU per request in the region Anthropic measured, memory use down more than 80 per cent across all of production, and median time to first token — the wait before a model starts streaming its reply — down about 20 per cent on Claude Code requests. Anthropic is careful about the numbers: CPU comes from one region, memory covers all of production, and latency covers a shorter window of Claude Code traffic. No absolute millisecond figures were published.
The broader point, Anthropic argues, is that production systems can now be rebuilt by the AI running on them — without a maintenance window or a paused roadmap. For a company whose models write most of its code, the API serving them was the obvious place to prove it.



