Anthropic Rewrites Claude Messages API in Rust

Anthropic Rewrites Claude Messages API in Rust

Anthropic reported on November 25, 2026 that Claude agents helped move its Messages API from Python to Rust without an outage or a freeze on feature development. Per-request CPU and memory use fell about 70% and more than 80%, respectively, while the median wait for the first response token fell about 20% for customers’ Claude Code requests. The Messages API serves as the central routing path for all Claude conversations, including requests from customers and Anthropic’s own applications.

Python to Rust conversion showing 70% CPU and 80% memory reduction in Claude API processing performance optimization.

Claude Wrote the Code in a Week

Claude produced the first version of Anthropic’s new API request path in about a week. The speed reflects a broader shift in how Anthropic develops software: By May 2026, Claude was also writing more than 80% of the code Anthropic merged across the company. This made a full rewrite economically viable, where it previously had been dismissed.

One-week development sprint timeline: code generation Monday, code review Tuesday-Wednesday, initial testing Thursday-Friday.

In 2024 one engineer had settled the question: “We are not rewriting the API in go or rust!” The company had initially explored a partial migration, An initial rewrite of model-output parsing in Rust cut CPU usage by about 8% to 10%, Anthropic reports, but each token then crossed between Python and Rust three times. The team concluded that the savings did not justify the added overhead and complexity.

Verification Was the Hard Part

While Claude generated the new code quickly, verifying it matched the old Python system exactly took far longer: Anthropic built a verifier that ran both versions side by side and compared results step by step, without ever reading the actual prompts or replies, to protect user privacy.

The hardest part wasn’t writing the new code but confirming it behaved identically to the old system under real traffic, including edge cases like how Python and Rust escape emoji differently in JSON. The verification process allowed Anthropic to migrate production traffic gradually while maintaining feature development on the existing Python API.

Python vs Rust verification process comparison engine showing code execution, real-time metrics, and edge case handling an...

The company’s production traffic had fully moved to Rust by September 2026. The phased rollout occurred with no service interruption and without freezing new feature development during the transition.

Performance Gains and Infrastructure Impact

The completed API uses approximately 70% less CPU per request and more than 80% less memory per request, according to Anthropic. The reduction in resource consumption directly impacts Anthropic’s infrastructure costs as Claude usage scales.

The Messages API, the path through which customers and Anthropic’s own apps like Claude Code reach Claude, saw traffic grow roughly 1,800 times since early 2024. This dramatic growth in request volume made efficiency improvements increasingly valuable from both cost and latency perspectives.

Traffic growth chart showing 1,800x increase from early 2024 to 2026, displaying massive scaling challenge with exponentia...

The latency improvements were particularly noticeable for coding workflows. The 20% reduction in median time to first token applies specifically to Claude Code requests, where faster initial responses improve the interactive development experience.

Key Facts

  • CPU reduction: About 70% less CPU per request in the Rust implementation
  • Memory savings: More than 80% less memory per request
  • Latency improvement: Approximately 20% faster median time to first token for Claude Code requests
  • Traffic growth: Messages API traffic grew roughly 1,800 times since early 2024
  • Development velocity: Claude was writing more than 80% of Anthropic’s merged code by May 2026
  • Migration timeline: Full production rollout completed by September 2026
  • Downtime: Zero service interruption during the migration

Broader Industry Implications

The migration demonstrates how AI-assisted development is changing the economics of large-scale rewrites. Anthropic’s experience suggests that the cost of major refactoring projects is shifting from code generation to verification and testing, particularly when maintaining compatibility with production systems under active development.

Software development economics shift: traditional 60% code generation vs 20% with AI, testing verification increases 40% t...

The company used its own Python API as the reference implementation, running shadow comparisons between the Python and Rust versions on live traffic to ensure behavioral equivalence. This approach let engineers validate the new implementation without exposing users to untested code paths.

Anthropic’s engineering post, published November 25, 2026, provides detailed metrics that quantify both the performance benefits and the development process behind the migration. The report confirms that production systems can be rewritten in modern languages without service disruption when proper verification infrastructure is in place.

Sources

Sources

  1. Anthropic Details Claude-Assisted Rust Migration of Messages API
  2. Anthropic Used Claude to Rebuild Its API in Rust, Cutting CPU Use 70% – TechRepublic
  3. Claude rewrote Anthropic’s Messages API in Rust, cutting CPU 70%
  4. Nov 26, 2026 – by Kelly Abbott – This is not Average

Written by

Mike Gingerich

Author

Author: Mike Gingerich, President of web firm Digital Hill, Co-Founder of TabSite .
Digital and Social Media Marketer, Speaker, and Business Consultant. Part geek, part marketer, total digital junkie! Seeking to add value, make the complex simple, and leave a positive impact.

Follow me on twitter: @mike_gingerich.