Anthropic says Claude helped rewrite its API in Rust, cutting CPU use per request by 70%

Claude logo displayed on a laptop screen beside a mug

Anthropic has moved a key part of the service that handles Claude requests from Python to Rust, and the company says the new version uses about 70% less CPU per request. Its measurements also show more than 80% less memory per request across production.

The change concerns the Messages API, the route developers and Anthropic’s own apps use to reach Claude. It is not a rewrite of the AI model itself. Public traffic moved to the Rust service in September 2026, according to the company’s engineering report published on November 25.

Claude helped build its own new plumbing: Anthropic says it wrote a first version of the core request path in about a week. Getting the replacement to behave like the existing service was a much bigger job, and the company’s account includes a revealing warning about relying on passing tests alone.

Anthropic chart showing API requests per day increasing from 2024 to October 2026

Anthropic says daily API traffic on its own platform grew roughly 1,800 times from early 2024 to autumn 2026. Image: Anthropic

The first Rust experiment saved CPU, but added complexity

Anthropic built the Messages API in Python in 2023, when it mainly passed requests to the model and returned its replies. As the service gained features, it had more work to do around each request, including validation, tokenisation and safety checks. Traffic on Anthropic’s own platform grew roughly 1,800 times from early 2024 to autumn 2026, including the company’s own use.

At first, the engineers moved only output parsing to Rust. Anthropic says that reduced API CPU use by around 8% to 10%, but it also meant each output token crossed between Python and Rust three times. The company decided that the smaller gain did not justify the added complexity.

The larger rewrite moved the request and response work around the model to Rust. For developers, that difference is worth keeping in mind: changing the API service is different from changing how Claude’s underlying model was trained or claiming that every part of Anthropic’s stack now uses Rust.

Anthropic diagram comparing the partial Python and Rust request path with the later Rust path

The partial migration sent each output token between Python and Rust three times, according to Anthropic. Image: Anthropic

Claude wrote code, but passing tests was not enough

In April, Anthropic says its Rust API passed about 98% of its tests, yet only about a quarter of the inputs matched the Python service on the production traffic being compared. An audit of the ported tests also found more than 100 weakened assertions, where a changed test could miss a problem it had previously caught.

The team compared the old and new paths using real traffic, running the model once and replaying its output to the Rust service. That avoided counting the same request twice and made it possible to compare the paths without confusing code differences with Claude’s varying replies.

Anthropic says it recorded the shape and location of differences without reading customer requests or Claude’s replies. Claude agents investigated discrepancies and proposed fixes, while engineers built the checks, steered the work and reviewed changes. As the company put it, “Verification, not generation, had become the bottleneck.”

Anthropic charts showing changes in CPU and memory per request and time to first token

Anthropic measured CPU in one region, memory across production and first-token time for customer Claude Code requests over a shorter period. Image: Anthropic

What the performance numbers actually cover

The reported CPU and memory reductions are per request, not a claim that Anthropic’s entire computing bill fell by those amounts. The CPU chart covers one region, while the memory chart covers production as a whole. Both use seven-day averages around the migration.

Anthropic also reports about a 20% reduction in the median time to the first token for customer Claude Code requests over a shorter period. That measures how quickly the first piece of a response arrived in that sample; it does not establish a 20% speed improvement for every Claude feature or user.

If the language change has made you curious about Rust, the Rust project’s official guide is free to read online. A third-edition paperback is also available for readers who prefer a printed guide.

We have also covered Anthropic’s move away from Git for its main code repository as its number of daily merges grew.

Image credits: Getty Images / IT Pro; Anthropic.

Leave a Comment

Your email address will not be published. Required fields are marked *