Anthropic rewrote its Messages API in Rust
Anthropic moved its Messages API from Python to Rust with Claude writing the code: about 70% less CPU per request, over 80% less memory, 20% lower median first-token time. No downtime, no price cut.
What happened
On November 25, Anthropic published an engineering post about a rewrite: the Messages API moved from Python to Rust. That API is the main path customers use to reach Claude, and the same path behind Claude Code and Cowork.
Three results. About 70% less CPU per request, more than 80% less memory, and roughly 20% lower median time to first token, measured on Claude Code requests from September 7 to 21. Public traffic moved to Rust in September with no downtime.
Why it had to change
The service was built in 2023 in Python and first did little more than pass requests to the model. It later grew validation, prompt transformation, tokenization, safety classification, token ordering, streaming and usage accounting. By late 2025, every request crossed several Python stages.
Traffic grew about 1,800 times between early 2024 and fall 2026. Object creation and memory management at each stage, multiplied by that growth, turned into the bill.
In March 2026 the team moved only output parsing to Rust. CPU fell 8% to 10%, and every token crossed between the two languages three times. The lesson: partial rewrites were not worth it.
Using production as the checker
The hard part was not writing code. By May, Claude had written more than 80% of Anthropic's merged code, and it produced a first version of the core request path in about a week.
The hard part was verification. The 700 existing integration tests were tightly coupled to the Python implementation and covered a small share of production. So the team used the live Python API as the reference: shadow production traffic, replay the same model output into the Rust service, and compare step by step.
Privacy was handled with fingerprints. The comparison logged byte offsets and length differences only, never user text. When a difference appeared, Claude agents reproduced it in a sandbox and opened a pull request. Engineers reviewed, then traffic confirmed. Human fixes became permanent rules for the next round.
How solid the numbers are
In April the Rust service passed about 98% of tests but matched only a quarter of real production inputs. By August it matched 99.6%. Between August and September the team merged more than 3,000 changes every two weeks.
One line from the post is worth keeping: verification, not generation, had become the bottleneck.
What to discount
First, the CPU, memory and latency figures are self-reported. No outside party re-ran them.
Second, the savings land on Anthropic's own fleet. They are not a price cut, and pricing and limits did not move.
Third, the method needs an existing system to compare against. A project starting from scratch has no reference to check itself with.
Fourth, Rust raises the maintenance bar. The post says plainly that the team had no Rust specialists, and the long-run staffing cost is not visible yet.
What to watch
Three markers. Whether lower cost per request shows up in prices. Whether the next large refactor is again agent-led. And whether other teams copy the live-service-as-verifier loop.
Nothing here is investment advice.
Source: Anthropic