Anthropic Rewrites Messages API from Python to Rust, Cutting CPU Usage by About 70%
Anthropic rewrote its Messages API from Python to Rust, reducing CPU usage per request by about 70% and memory consumption by more than 80%. Although the new implementation passed 98% of existing integration tests, it initially matched only about 25% of inputs when compared against production traffic. Completed in September, the migration covered the core request-processing infrastructure used by customers, Claude Code, and Cowork.
Why read this
AI score 65
The migration highlights both resource reductions and testing blind spots, providing a concrete case study for evaluating the reliability of AI-generated code in production refactoring.
Topics
Body
Anthropic has rewritten its Messages API from Python to Rust, cutting CPU usage per request by around 70% and memory consumption by more than 80%.
However, the migration exposed a significant problem with AI-generated code: despite passing 98% of its existing integration tests, the new implementation initially matched only around 25% of inputs when tested against live production traffic.
The migration, completed in September, involved rebuilding the core request-processing infrastructure through which customers access Claude, including Anthropic's own products such as Claude Code and Cowork. The company detailed the project in a recent engineering blog post.
Anthropic said API traffic on its platform grew roughly 1,800 times between early 2024 and autumn 2026. The original Python service, built in 2023 as a relatively simple request-forwarding system, had become increasingly expensive to operate as it took on additional responsibilities.
AI Trends