Claude Migrates Its API to Rust: 70% Less CPU Despite the Ban
Claude migrates its API to Rust: Anthropic rewrote its Messages API with agents and cut CPU by about 70%. Why the tests weren't enough.
Claude migrates its API to Rust: Anthropic migrated its Messages API from Python to Rust using Claude agents. According to Anthropic Research (November 26, 2026), the result was about 70% less CPU per request and about 20% lower median time to first token, without taking the service offline. In 2024 someone inside the company had written that the API would not be rewritten in Go or Rust.
How Claude migrates its API to Rust
Two years later, Claude wrote the first version of the core in a week. The problem wasn't writing the code: it was proving the Rust version behaved the same as the Python one.

The migration's three steps, according to Anthropic
- Compare every real request against the Python version.
- Replay the same model response in Rust: it runs the model once and reuses that response in both versions.
- Dispatch agents to fix each difference that shows up when comparing each step.
Anthropic used its own production API as the verifier, without switching anything off.
Why the tests weren't enough
The Rust API passed about 98% of its tests in April, but only about a quarter of inputs matched production. The rule this case leaves: if you can't verify the AI, you can't trust it. Verifying with real traffic is what closed the gap.

What to take with care
These are Anthropic's figures, not measured by third parties, and they don't prove on their own that Rust is the cause of the whole improvement. The result is about one specific API, Anthropic's Messages API, so it isn't a promise that your migration will perform the same.
How to apply it in your business?
If your team plans to migrate a service to another language, don't stop at the tests: compare responses with real traffic against the current version, and review each difference before switching. Reuse the same input in both versions to isolate what changed. If you use AI agents to fix differences, keep a person reviewing what they merge. And measure CPU and time to first token before and after, with your own numbers. To see another case of Claude agents working on code, read the summary of Claude Ship and its three agents.
FAQ about Claude and the Rust migration
What did Anthropic migrate to Rust?
Its Messages API, from Python to Rust, using Claude agents.
What improvement did it get?
According to Anthropic, about 70% less CPU per request and about 20% lower median time to first token, without taking the service offline.
Why weren't the tests enough?
The Rust version passed about 98% of its tests, but only about a quarter of inputs matched production.
Are the figures independent?
No: they're Anthropic's and don't prove on their own that Rust explains the whole improvement.
Conclusion
When Claude migrates its API to Rust, the lesson isn't the language: it's that without verifying against real traffic, tests alone aren't enough. Save this for your next migration and send it to your development team.
Source: Anthropic Research, "Migrating our API to Rust" (Nov 26, 2026).