Anthropic moves its Messages API from Python to Rust with Claude: a first version of the core request path in about a week, then months of agent-fixed parity gaps on shadowed production traffic, ending at about 70% less CPU per request
Anthropic migrated its Messages API, the main way customers and its own apps such as Claude Code reach Claude, from Python to Rust. An earlier partial rewrite of the output parser in Rust cut CPU by about 8% to 10% but each token then crossed between Python and Rust three times. Claude wrote a first version of the API's core request path in Rust in about a week; the hard part was verification. The roughly 700 integration tests were coupled to the Python implementation, and an audit of the ported tests found more than 100 weakened assertions. In April the Rust API passed about 98% of its tests while only about a quarter of inputs matched on production traffic. The team shadowed production requests, replaying a single model output to both versions, and recorded only the shape of each difference (checkpoint, prompt piece, first differing byte, lengths) rather than customer text. A script grouped diff records every 10 to 30 minutes and alerted a coordinating Claude agent to new kinds of difference; it assigned a worker agent to each and opened a Slack thread for engineers. Worker agents ran in cloud sandboxes with both codebases and local input and output checks that took under a second, wrote their own requests to reproduce a fingerprint, edited the Rust until the versions matched and added a failing-then-passing test. Engineers reviewed fixes before they crossed into an outer loop that checked them on shadowed traffic, and a memory loop turned corrections into rules, searches and tests (one rule led an agent to find seven more places where the port had guessed). Public traffic moved to Rust in September 2026. The Rust API uses about 70% less CPU per request and cuts median time to first token by about 20%, without taking the service offline or freezing feature development.
The numbers (as reported)
| First Rust version of the core request path | Written by Claude in about a week |
|---|---|
| CPU per request after the move | About 70% less |
| Median time to first token | About 20% lower (customers' Claude Code requests) |
| Tests vs production parity, April | About 98% of tests passing; only about a quarter of inputs matched on production traffic |
| Existing integration tests | About 700; audit of ported tests found more than 100 weakened assertions |
| Earlier partial Rust rewrite (output parser only) | About 8% to 10% less CPU |
| Timeline | Shadow testing from April; public traffic moved to Rust in September 2026 |
Facts
- Company / subject
- Anthropic
- Tools
- Claude
- Codebase
- brownfield
- Work type
- Language port
- Stack
- Python, Rust
- Published
- 2026-11-25
- Last checked
- 2026-11-30
What the source claims Vendor-published
Claimed by the vendor that sells the tool. Not checked independently.
- Rust API uses about 70% less CPU per request About 70% less CPU per request
“ship an API on Rust that uses about 70% less CPU per request”
- Median time to first token cut by about 20% About 20% lower median time to first token
- Claude wrote a first version of the core request path in about a week About a week
“Claude wrote a first version of the API’s core request path in about a week.”
- Shipped without taking the service offline or freezing feature development
Caveats
Written by Anthropic about its own API and its own model, so a vendor source. The tool is given only as Claude (agents, a coordinating agent and worker agents); no named product such as Claude Code is credited with the work. The 'about a week' is for a first version of the core request path only; the migration ran from at least April to September 2026, and building the call to the tool-description service alone took the team weeks. The CPU figure is for one region, memory is all of production, and the time-to-first-token figure is for customers' Claude Code requests over a shorter period; values are seven-day averages indexed to just before the move. Merged-change counts are shown in a chart only and the post says not all are migration work. No cost or headcount is given.
More stories by tool: Claude
Related topics: Language portsBrownfield codebasesVendor case studies