Skip to content

Anthropic says moving its Claude API to Rust cut CPU use by 70%

News
An orange cable runs between two server racks.
Editorial illustration of the infrastructure behind an API.
Anthropic says its move from Python to Rust cut CPU use per request by about 70% for the Messages API, the main way apps reach Claude. The median wait for the first piece of a reply fell by about 20%, the company said in an engineering report on November 25. Its account of the switch explains why proving that old features still worked took longer than writing the first version.

The rewrite changed the service around Claude

The API checks a request, sends it to the model and sorts its reply into sections such as text and tool calls. Anthropic says its API traffic rose about 1,800-fold from early 2024 to fall 2026. Its engineering report says an early move of just the output parser to Rust saved about 8% to 10% of API CPU use. It still made each piece of a reply cross between the two languages three times.
The full rewrite moved those steps into Rust. The reported CPU figure covers the API’s handling of a request. The time figure measures how soon a reply starts to arrive.

Anthropic checked the old and new versions side by side

Claude wrote a first version of the core request path in about a week. The team then compared the two versions on live traffic. The Python service kept changing, and a model could give two different answers to the same input. Engineers needed checks that could spot a change in what the service did even when the model varied its reply.
Anthropic says agents grouped mismatches, proposed fixes and added tests. Engineers reviewed the fixes before they could run in production. Public traffic moved to Rust in September. Our coverage of Cline-Bench’s repeated runs looks at a related problem: how to tell one good result from a repeatable one.
loading

Loading