Anthropic migrates the Messages API to Rust
Migrating our Messages API to Rust
Anthropic migrated the Messages API from Python to Rust; the new version reduces CPU per request by about 70%, shortens median time to first token by about 20%, and did so without downtime or freezing feature development. This API is the main interface through which customers and its own applications such as Claude Code and Cowork access Claude; traffic grew about 1800-fold from early 2024 to autumn 2026. The bottleneck in the migration was verification rather than generation: the roughly 700 existing integration tests were coupled to the Python implementation and had incomplete coverage; in April the new API passed about 98% of the tests, yet on production traffic only about a quarter of inputs matched. The team used the production system itself as the verifier, locating differences with checkpoints and classifying bugs by fingerprint without reading user requests, and used an inner sandbox, outer production-traffic comparison and a memory loop to let agents automatically fix differences; fixes had to be reviewed by engineers.
The original source presents the complete approach of using the production system itself as the verifier and having agents automatically fix differences through multiple layers of loops, which teams facing large-scale code migrations can draw on.