Anthropic moves Claude API to Rust, cuts CPU use 70%

Anthropic has moved the Messages API behind every Claude request from Python to Rust, cutting CPU use by about 70% per request and speeding up the first token of a reply by about 20%. The company described the migration in an engineering post published on 25 November, saying the new version now carries all public traffic after a months-long switch carried out without taking the service offline.
The Messages API is the route through which customers, as well as Anthropic's own products Claude Code and Cowork, reach Claude. Anthropic built it in Python in 2023, when it was little more than a service that passed requests to the model and returned what the model wrote. Traffic then grew roughly 1,800 times between early 2024 and autumn 2026, and the Python service began to cost too much computing power on every request.
Claude rebuilt its own gateway
The striking part of the story is who did the work. Anthropic says Claude wrote a first version of the API's core request path in about a week. By May 2026, the company says, Claude was writing more than 80% of all the code Anthropic merged across the company, which made a full rewrite practical in a way it had not been before.
An earlier attempt at a smaller fix had shown why a partial approach would not work. Rewriting only the code that parses a model's output in Rust, and calling it from Python, cut CPU use by just 8% to 10%, while each token then had to cross between the two languages three times. The gains did not justify the extra complexity, so Anthropic decided to rewrite the whole service.
Proving the new version behaved identically
Writing the Rust code turned out to be the easier half of the job. The hard problem was proving that the new service behaved exactly like the old one. Anthropic's test suite held about 700 integration tests, but the company found more than 100 weakened assertions when it audited the ported tests, and many real behaviours were never covered by tests at all.
The team therefore turned the production Python API into a checker for its replacement, a technique known as shadowing. Requests were run through both versions, with the model itself run only once and its output replayed to the Rust code, so that a customer was never billed or limited twice and the model's own unpredictability could not confuse the comparison. Each stage of a request was compared step by step, and differences were recorded only as a fingerprint of where they happened and how large they were, so engineers never had to read customers' requests or Claude's replies.
The gap the method exposed was large. In April the Rust version passed about 98% of its integration tests, yet only about a quarter of real production inputs matched the Python version. One cause was small but telling: when Python wrote JSON tool calls it escaped some characters, such as emoji, as text codes, while Rust wrote the characters as they were, so the two prompts differed by a few bytes.
Agent teams fixed the mismatches
Each mismatch was handed to Claude agents working in loops. A fast inner loop let agents test ideas in a cloud sandbox in seconds, a slower outer loop checked fixes against shadowed production traffic, and a memory loop recorded mistakes so later agents could learn from them. Human engineers followed the work in a shared channel and could steer it when needed.
Public traffic moved fully to Rust in September 2026, and Anthropic says the completed service uses about 70% less CPU per request and more than 80% less memory, with median time to first token down by about 20%. The company stresses that the figures describe its own servers and its own traffic, not a promise that another Python application rewritten in Rust would see the same gains. For developers using Claude, nothing changes on the surface: the same endpoint, faster first words, and a migration their own AI assistant largely carried out.