Anthropic rewrote Claude's Messages API in Rust, cut CPU use 70%
The Messages API, the main route into Claude for external customers and tools like Claude Code, moved off Python in September after traffic grew roughly 1,800 times since 2024.
Anthropic has migrated the Messages API, the endpoint that handles most external requests to Claude, from Python to Rust. The company says the move cuts CPU use by about 70% per request, memory use by more than 80%, and median time to first token by about 20%. Public traffic moved to the new version in September, with no downtime and no feature freeze during the rewrite.
The harder part wasn’t writing Rust. An initial incremental rewrite in April only got an 8 to 10% CPU reduction, and even once a fuller Rust version passed 98% of its integration tests, only around a quarter of real production inputs matched the Python version’s behaviour. Anthropic’s fix was traffic shadowing: replaying live requests through both implementations and comparing results at every stage, with Claude agents doing the comparison work under human review.
Why it matters: this is a direct performance win for anyone calling the Claude API, faster time to first token and lower infrastructure overhead, shipped without an announced API change. It’s also a concrete data point on using agents for a large migration: Claude wrote most of the new code quickly, but closing the gap between “tests pass” and “behaviour matches” took months of verification, not generation.
The caveat: the figures are Anthropic’s own internal measurements, not an independent benchmark, and describe aggregate infrastructure gains rather than a guarantee for any specific request.