Analysis read

Anthropic moves its Messages API from Python to Rust, cutting CPU 70%

Anthropic says Claude wrote most of a Rust rewrite of the API behind every Claude request, cutting CPU per request by about 70%. The engineering write-up argues verification, not code generation, was the real bottleneck.

AE
Aidose Editorial
Nov 28, 2026

Anthropic has published an engineering account of how it migrated the Messages API, the endpoint behind every Claude API call and the company's own apps including Claude Code and Cowork, from Python to Rust. According to the post, dated November 25, public traffic moved to the Rust service in September 2026 without the service being taken offline, and Claude wrote much of the new code.

Anthropic reports that the Rust version uses about 70% less CPU per request, more than 80% less memory per request, and cut median time to first token by about 20%. The original Python service dated from 2023, and Anthropic says API traffic grew roughly 1,800 times between early 2024 and fall 2026. An earlier partial rewrite of only the output-parsing code in Rust saved about 8% to 10% of CPU, but the team judged the extra complexity not worth it and moved the full request path instead.

Claude produced a first version of the core request path in about a week, the post says. Getting it to match Python's behavior took months. In April the Rust service passed about 98% of roughly 700 integration tests, yet only about a quarter of real production inputs produced matching output; by August that match rate reached 99.6%. An audit also found more than 100 weakened assertions in tests that had been ported.

The fix was to use production as the verifier. Anthropic shadowed live traffic by running the model once and replaying its output through both implementations, and recorded privacy-preserving diff records of where outputs diverged, without storing customer text. A script clustered new kinds of differences every 10 to 30 minutes and handed them to agents, which reproduced issues in sandboxes and opened pull requests with fixes and tests for human review. Merged changes rose from under 100 per two-week period in April to more than 3,000 in the period starting August 10.

For teams attempting large AI-assisted rewrites, Anthropic's conclusion is that generation is no longer the hard part: verification is. The post recommends designing verification signals agents can act on, encoding engineers' corrections as rules, tests and lints, and keeping human review as a gate, since a verifier that rewards matching outputs does not guarantee a good fix.

AE
Aidose Editorial
Nov 28, 2026 · read
Back to News