Anthropic Rebuilt Its Messages API in Rust — and Cut CPU Use by 70%
November 29, 2026

Anthropic has rebuilt the gateway through which every Claude request travels. The Anthropic Rust API — a from-scratch rewrite of the company’s Messages API, moved from Python to Rust — uses about 70 per cent less CPU per request and more than 80 per cent less memory, and cuts the median time to the first token of a reply by about 20 per cent. Anthropic described the migration in a post published on 25 November 2026, saying it finished with no downtime and no freeze on feature development. The striking part is not the rewrite itself: Claude agents wrote much of the new code, and proving it behaved exactly like the old code took far longer than writing it.
The Messages API is the primary way customers reach Claude, and Anthropic’s own products, including Claude Code and Cowork, use the same route. Built in 2023 in Python, it began as little more than a request forwarder. By late 2025, every request had to be validated, tokenised and screened by safety classifiers, and Python added overhead at every step. Meanwhile, traffic had grown roughly 1,800 times between early 2024 and the autumn of 2026, far beyond what the original service was built to carry.
Why the Anthropic Rust API became necessary
The obvious fix was tried first. Anthropic rewrote the code that parses a model’s output in Rust and called it from Python. CPU use fell by about 8 to 10 per cent, but each token then crossed the boundary between the two languages three times, adding complexity and new overhead. The team committed to a full rewrite instead.
In 2024, when one engineer suggested moving to Go or Rust, a colleague answered: “We are not rewriting the API in go or rust!” The calculation changed as Claude improved: by May 2026 it was writing more than 80 per cent of the code Anthropic merged, and it produced a first version of the API’s core request path in about a week. “Verification, not generation, had become the bottleneck,” the engineers wrote.
The test suite could not be trusted
The team started with about 700 integration tests, but two problems limited their value. First, the tests were coupled to the Python implementation, mocking services such as billing in Python’s memory. Claude helped port both code and tests, so a pass could mean the code was right — or that the test had been weakened. An audit found more than 100 weakened assertions.
Second, the tests were incomplete: just 20 binary options produce over a million combinations. In April 2026, the Rust API passed about 98 per cent of its tests, yet only about a quarter of production inputs matched the Python version on live traffic. Some gaps were subtle: Python escapes certain characters in JSON tool calls, such as an emoji, while Rust wrote them as they were — a difference of a few bytes, enough to change a reply without triggering an error.
Shadowing live traffic without reading it
Anthropic’s answer was to turn the production system itself into the verifier, using a technique called shadowing: run requests through both versions and compare the results. A request could only count once towards a customer’s limits and bill, and Claude’s replies are nondeterministic, so a difference did not necessarily mean a bug. The team ran the model once and replayed its output to the Rust version, so every step could be compared exactly.
Privacy added a third constraint: the team worked without reading user requests or replies. Instead, it recorded the shape of each difference. Checkpointing compared the two versions step by step, and a fingerprint — where in the prompt a difference began, and how long it was — distinguished one bug from another. Thousands of records sharing a fingerprint could be grouped into a single fix.
Three loops of agents, with humans at the gate
A script ran every 10 to 30 minutes, grouped new records by fingerprint, and alerted a coordinating agent only when a new kind of difference appeared. The coordinator assigned a worker agent to each kind and opened a Slack thread for engineers to follow.
In the fast inner loop, agents worked in cloud sandboxes holding both codebases, testing ideas in under a second without calling the model. They guessed causes, reproduced each bug, edited the Rust code and added a failing-then-passing test. In the slower outer loop, reviewed fixes were deployed and checked against shadowed production traffic. In the memory loop, review lessons became rules for later agents — including a rule to port exactly what Python did, which uncovered seven more guessed behaviours.
Human review stayed at the gate, and the post shows why. In mid-May, an agent proposed fixing a missing web search tool description by copying the text into files Rust could read. An engineer rejected it: Rust still needed to call the internal service supplying the descriptions. A verifier can say whether outputs match, the engineers wrote, but not whether a fix is good enough to ship.
What changed, and what it means
Public traffic moved to the Rust service in September 2026, a few requests at a time, according to secondary reporting of Anthropic’s account. Anthropic reported about 70 per cent less CPU per request and a median time to first token about 20 per cent lower; the memory figure of more than 80 per cent less per request was reported by TechRepublic and DevOps.com from Anthropic’s account. Note the response-time figure was measured on Claude Code requests over a shorter window, a scope difference TechRepublic flagged.
For Claude users, the effect is a faster start to each reply and a cheaper service for Anthropic to run. The wider lesson echoes Anthropic’s earlier work on Claude Ship, which lets AI agents review, fix and approve code changes, and on Siren, its evaluation of Claude models in weakened sandboxes. As AI models write more code, the scarce resource is no longer generating it — it is building trustworthy ways to check it.