Anthropic’s Rust Messages API Cuts CPU Use 70% After No-Downtime Migration
Anthropic says its Rust API uses 70% less CPU and 80% less memory per request, with 20% faster median time to first token.

Anthropic says it moved its production Messages API from Python to Rust without taking the service offline or pausing feature development. The company reports about 70% less CPU use per request, 80% less memory use and a 20% reduction in median time to first token. The project’s harder problem wasn’t producing the Rust code: it was proving that the replacement behaved like the Python service while the live system kept changing.
The team’s approach was to use the production API as a verifier. It sent live requests through both implementations, recorded differences without retaining customer content, and used those records to guide automated agents toward fixes. Engineers described this as a way to make a large migration manageable when code generation had become faster than validation.
Why the Python service needed a rewrite
Anthropic launched the Messages API in 2023 as a simple Python request forwarder. It became the primary route through which customers and Anthropic’s internal applications reached Claude. According to the engineering team, API traffic grew more than 1,800 times between early 2024 and fall 2026.
As the service took on more work, each request had to be validated, converted into a prompt, tokenized and checked by safety classifiers. Responses also needed to be separated into text, thinking and tool calls. Python added overhead across these steps, while the service accumulated dependencies on Python libraries as Claude became more capable and more integrated with codebases.
Anthropic first tried rewriting the slowest parts of the system. Those incremental changes reduced CPU use, but the gains didn’t justify the added complexity of maintaining a mixed implementation. By May 2026, the team said Claude was writing more than 80% of the code Anthropic merged, making a full migration more practical. That raised the question of whether the new implementation could be trusted in production.
Production traffic became the test
The team had roughly 700 integration tests, but found they didn’t provide enough confidence. They were incomplete and tied to details of the Python implementation; some tests could pass even when behavior was wrong. That was a particular problem because models and features kept changing, making a fixed definition of correct behavior hard to maintain.
Anthropic then ran requests through both the existing Python service and the new Rust version, comparing their outputs. Each mismatch generated a compact record describing where the implementations differed, without including customer content. Those records could be sent to an agent to investigate and propose a fix.
A single bug could create hundreds of thousands of similar records, so the team built a process to handle them. In its fast inner loop, an agent examined a difference, tested a hypothesis in a sandbox and suggested a correction. The team said this loop took less than a second. It let agents test requests they had written, but didn’t always reproduce production configuration exactly.
A slower outer loop checked proposed fixes against production deployments, comparing Rust versions with and without each change. This caught issues that the local sandbox missed. A third loop recorded lessons from agent work and human review, then made those lessons available to later agents. For example, when an engineer rejected a shortcut involving web search, the system saved the decision, its rationale and the expected way to fix the underlying issue.
What the migration changes for engineering teams
The reported resource reductions give Anthropic more room to serve traffic on the API, while the shorter median time to first token means users receive the start of a response sooner. The company’s figures describe its own service; the engineers did not provide test conditions or a broader benchmark for applying those results to other systems.
The team’s wider conclusion is that verification can become the main constraint when AI agents make implementation faster. For production systems, tests may not capture every behavior, especially when dependencies and live features change. Anthropic’s method supplied a useful signal by locating each difference and using fingerprints to distinguish one bug from another.
The engineers also argued that agent workflows should allow autonomous investigation while keeping human judgment focused on defining correct behavior. Early in the project, engineers ran Claude themselves and chased differences. They later steered agents and reviewed fixes, then moved further outward to write rules and checks as the process matured.
For teams considering a similar migration, the practical lesson is to plan the verification system alongside the rewrite. Shadow comparisons, clear records of mismatches, production checks and retained review lessons gave Anthropic a way to keep feature work and service availability in place while replacing the API. Its experience suggests that the quality of those checks will determine how confidently teams can put AI-generated changes into production.