Anthropic rewrites its Messages API in Rust with Claude agents
Anthropic says the Rust version uses about 70% less CPU per request and was checked against live production traffic, with Claude agents fixing mismatches.
Summary

In brief
- Anthropic says the Rust API uses about 70% less CPU per request
- Messages API traffic grew roughly 1,800 times from early 2024 to fall 2026
- Rust version passed about 98% of tests in April but matched about a quarter of live inputs
Anthropic has moved its Messages API, the main way customers and its own apps such as Claude Code reach Claude, from Python to Rust, the company said on Wednesday in an engineering post.
The project tests whether coding agents, AI systems that run multi-step programming tasks on their own, can be trusted to rebuild live systems, where customers rely on edge cases and quirks that fall outside the test suite. Claude wrote a first version of the API's core request path in about a week, the company said, but proving that it behaved like the production service became the harder problem.
Anthropic said the Rust service uses about 70% less CPU per request and cuts median time to first token, the wait before a reply starts streaming, by about 20%. The company said it shipped without taking the API offline or freezing feature development. The performance figures are the company's own and have not been independently verified.
The rewrite was driven by load, according to Anthropic. API traffic grew roughly 1,800 times between early 2024 and fall 2026, and Python added overhead to every step of a request, from validating it and screening it with safety classifiers to sorting the model's output into text, thinking, and tool calls.
An earlier partial fix, rewriting only the output parser in Rust and calling it from Python, cut CPU use by about 8% to 10%, Anthropic said. The gain did not justify the added complexity, the company said, because each token, a unit of the model's output, then crossed between the two languages three times.
Tests alone could not settle whether the new version was correct. The Rust API passed about 98% of its tests in April, yet only about a quarter of inputs matched on production traffic, Anthropic said, and an audit of the ported integration tests found more than 100 weakened assertions, checks changed in ways that could let wrong code through. The company instead ran production requests through both versions and compared the results, a technique known as shadowing, and automatically dispatched Claude agents to fix the differences.
The comparison was complicated by a moving target. The Python API kept changing throughout the migration, Claude can answer the same request differently each time, and the company said its engineers could not read customer requests to see where the versions diverged.
Anthropic built the Messages API in Python in 2023, when one engineer called it “basically a request forwarder,” and in 2024 an engineer rejected a colleague's suggestion to move it to Go or Rust. By May 2026, Claude was writing more than 80% of the code Anthropic merged, the company said. Shadowing has precedent: GitHub released version 1.0 of Scientist, a tool that runs old and new code side by side on live data, in February 2016.