Anthropic moves Claude API to Rust and reports a 70% cut in CPU use
The Python service kept answering customers while engineers compared the two implementations. Anthropic measured the reported performance gains itself.
By Wellinton OliveiraCEO of Lyntev
Published
3 min read

Key points
- On 25 November, Anthropic confirmed it had migrated the main programming interface for Claude from Python to Rust.
- It reports about 70% lower CPU use per request and about a 20% drop in median time to the first token.
- The new implementation ran in parallel. The team called the model once and used the same result in both versions.
- The metrics cover different populations. The latency figure comes from customer requests to Claude Code and covers a shorter period.
On 25 November Anthropic explained how it moved the service that routes customer and application requests to Claude from Python to Rust. The change concerned the Messages API, the programming interface (opens in a new tab) that accepts messages and returns what the model writes. The Rust version used about 70% less processor time per request, according to Anthropic’s engineering account (opens in a new tab).
The new code also cut memory use per request and the time before a response started to appear, Anthropic says. It kept serving requests during the transition and continued to add features to the Python service while rebuilding it. That meant the reference version was still changing as the teams compared it against Rust.
What the three figures measure
| Metric | Reported change | Sample |
|---|---|---|
| CPU time per request | About 70% less | One region |
| Memory per request | More than 80% less | Production service |
| Median time to first token | About 20% less | Claude Code customer requests, shorter period |
A token is a unit of text that the model processes. Time to first token measures how long the response takes to begin. If it falls, users may notice less initial waiting. The figure does not show how long an entire answer takes. The time window and the requests used to measure this latency differ from the other two indicators in the table.
Anthropic says traffic grew roughly 1,800 times from early 2024 to autumn 2026. As demand grew, the API took on work validating requests, preparing input for the model and handling the stream of output. An initial rewrite that put only output parsing in Rust saved between 8% and 10% of CPU use. Each token still passed back and forth between the two languages.
Why the test suite was not enough
In April the Rust implementation passed around 98% of its tests, according to the company. When engineers put it alongside Python on live requests, only about a quarter of the inputs sent to the model matched. The numbers describe two different comparisons. A test suite counts each case once. A discrepancy that is triggered regularly shows up each time in a sample of live requests.
Anthropic gives the example of how the service represented some characters in the data for a tool call. The original version changed how certain characters were written while preparing the model’s input. The Rust version left them as they were. The variation could look small to a developer, but it changed what reached the model and could change what it wrote back.
Using one model call to compare two services
A model can return a different answer when asked the same question twice. To isolate what the surrounding software changed, Anthropic ran the model once and replayed the output to the Rust implementation. The new code ran alongside the working service. Its output during that comparison was separate from the response being served to the customer.
Anthropic says it stored details such as the step, size and position where the versions first differed, without retaining the text of customer requests or replies in the comparison logs. Coding agents then made their own sample inputs to reproduce each issue. Engineers reviewed the proposed fixes before they went through checks on production traffic.
When one discrepancy kept showing up across requests, the system grouped the occurrences and opened an investigation into their common cause. The team turned recurring corrections into tests or review instructions. As a result, engineers could examine specific problems without needing to see what customers had written in their conversations with Claude.
What the measurements still leave open for customers
Anthropic moved traffic in stages once it judged the implementations sufficiently close. The gains reflect the load and features of this particular API. The account gives no basis for estimating what a different application would gain from a change to Rust.
The published figures give measures of computing resources and initial latency. They do not measure the time to a full response across all Claude products and establish no reduction in what users pay. They show what Anthropic observed in its own infrastructure after the migration.
Disclosure: Lyntev, which publishes this site, is an Anthropic customer and uses Claude models in its work, including in its website assistant. How it works.
From Lyntev, which publishes this site
Put it into practice
- Integrating systems by API: contract and failuresFree guide. Data source, permissions, pagination and recovery, with acceptance criteria.
- What AI costs a business: how to estimate itFree guide. Usage, tools, repeats and review in one calculation, with consumption limits.
Sources
Documents and reporting consulted for this story.
- Migrating our Messages API to Rust (opens in a new tab)Anthropic, . Primary source. Accessed 25 November 2026
- Messages API reference (opens in a new tab)Anthropic, . Primary source. Accessed 25 November 2026




