Anthropic rewrites its Messages API in Rust
Anthropic moved its Messages API from Python to Rust with Claude writing much of the code, cutting CPU per request by about 70% and using live production traffic to check the new version.
Anthropic described how it moved its Messages API from Python to Rust. The API is the main way customers reach Claude, and Anthropic's own apps, Claude Code and Cowork, use it too. The company says the Rust version uses about 70% less CPU per request and cuts median time to first token by about 20%. The service never went offline during the migration, and feature development never paused.
The reason was scale. Anthropic says API traffic grew roughly 1,800 times between early 2024 and fall 2026. Python added overhead to every request, which had to be validated, tokenized and screened by safety classifiers before streamed tokens were sorted into text, thinking and tool calls. An earlier partial fix moved output parsing into Rust and called it from Python. That cut CPU use by 8–10%, but each token crossed between the two languages three times, and the team decided the gain wasn't worth the extra complexity.
Claude wrote a first version of the core request path in about a week. Anthropic says the hard part was checking that the new version behaved the same as the old one, not writing it. Three things made that difficult: the Python API kept changing during the migration, Claude can give different answers to the same request, and engineers could not read customer requests to see where the two versions diverged.
Anthropic's solution was to use the production API as the reference. It tested the Rust version on live traffic, flagged where its behavior differed, and automatically sent agents to fix those differences. The company notes that by May 2026, Claude was writing more than 80% of the code Anthropic merged.
The source text cuts off partway through the technical description, so details of how the comparison system works are not yet available.