News EngineAI Pledges 1 Billion Yuan for a Robot Developer Ecosystem as It Opens Its Behavior Foundation Model Security AWS Patches Kiro Web Flaw That Let Tool-Call Markup Hidden in Files Run Commands With No Consent Prompt Business S&P Puts Nvidia AA Rating on CreditWatch Negative as the Cost of Insuring AI Debt Hits Records News Neuralink Wins FDA Approval for LINK, the First Pivotal Trial of an Implantable Brain-Computer Interface in the US AI Agents Cloudflare Turns Every Website Into a Searchable Index for AI Agents With a Single Dashboard Toggle Business a16z Is in Talks to Raise About 20 Billion Dollars Across Its Next Fund Set, Ten Months After Its Last 15 Billion-Plus Haul Opinion Dario Amodei Calls Claims That Anthropic Wants to Surrender Human Free Will to AI "Absurd", and Accuses Rivals of Vibes-Based Posturing Chatbots Apple Removes MiniMax's Talkie AI Companion App Worldwide After Investigators Found Characters Degrading Child Users News EngineAI Pledges 1 Billion Yuan for a Robot Developer Ecosystem as It Opens Its Behavior Foundation Model Security AWS Patches Kiro Web Flaw That Let Tool-Call Markup Hidden in Files Run Commands With No Consent Prompt Business S&P Puts Nvidia AA Rating on CreditWatch Negative as the Cost of Insuring AI Debt Hits Records News Neuralink Wins FDA Approval for LINK, the First Pivotal Trial of an Implantable Brain-Computer Interface in the US AI Agents Cloudflare Turns Every Website Into a Searchable Index for AI Agents With a Single Dashboard Toggle Business a16z Is in Talks to Raise About 20 Billion Dollars Across Its Next Fund Set, Ten Months After Its Last 15 Billion-Plus Haul Opinion Dario Amodei Calls Claims That Anthropic Wants to Surrender Human Free Will to AI "Absurd", and Accuses Rivals of Vibes-Based Posturing Chatbots Apple Removes MiniMax's Talkie AI Companion App Worldwide After Investigators Found Characters Degrading Child Users

Anthropic Rewrote Its Messages API From Python to Rust Using Claude Agents, Reporting 70% Less CPU Per Request

Anthropic Rewrote Its Messages API From Python to Rust Using Claude Agents, Reporting 70% Less CPU Per Request

Anthropic says it migrated the Messages API, the primary path customers use to reach Claude, from Python to Rust without downtime, cutting CPU per request by about 70% and median time to first token by about 20%. The figures come from the company's own engineering post and have not been independently verified.

Anthropic has detailed how it migrated the Messages API — the primary way customers and its own apps, including Claude Code and Cowork, reach Claude — from Python to Rust, reporting that the new service uses about 70% less CPU per request and cuts median time to first token by about 20%, all without taking the API offline or freezing feature development. All performance figures come from the company's own engineering post; no independent measurements have been published.

The context explains the urgency. Anthropic built the Messages API in 2023 in Python, and one engineer described the original service as "basically a request forwarder." By late 2025 it had grown into a pipeline that validated every request, built the prompt, tokenized it and screened it with safety classifiers, then sorted each reply's token stream into text, thinking and tool calls — with Python overhead at every step. From early 2024 to fall 2026, the company says API traffic grew roughly 1,800 times.

The first attempt was the textbook approach: rewrite only the slow parts. Anthropic moved the model-output parser to Rust and called it from Python. That cut CPU usage by only about 8 to 10 percent, because each token of a reply crossed the Python-Rust boundary three times. What changed the calculation was the falling cost of writing code: by May 2026, the company says, Claude was writing more than 80% of the code Anthropic merged, and Claude produced a first version of the new API's core request path in about a week.

The hard part was not writing the Rust but proving it behaved like production. Parity was a moving target because the Python API kept changing. Claude replies nondeterministically, so a difference between two outputs did not necessarily mean a bug. And Anthropic could not read customer requests, so it could not easily see where the versions diverged. Its existing suite of about 700 integration tests turned out to be a poor judge: the tests were coupled to the Python implementation, and an audit found more than 100 weakened assertions introduced during porting.

Anthropic's answer was to make the running production API itself the verifier. The team tested the Rust version against live production traffic, found where the two diverged, and automatically dispatched Claude agents to track down and fix the differences. The company frames the result as a general lesson: with code generation cheap, verification becomes the bottleneck, and a production system can serve as the oracle when no test suite is thorough enough.

For an industry wondering what agents can safely be trusted to rewrite, the post is one of the clearest data points yet. The caveat stands: the 70% and 20% numbers are the migrating team grading its own homework. But the pattern — keep the old system running as the judge, let agents close the gap, then move passengers over a few at a time — is likely to be copied well beyond one API.

Comments (0)

Log in to join the discussion

Log In

No comments yet