Anthropic moved its Claude API from Python to Rust with Claude doing the coding: what teams can learn
Anthropic says Claude rewrote its Messages API in Rust, cutting CPU per request by about 70% and median time to first token by about 20%. The real lesson is how they checked the work.
- Author
Umair Mateen- Published
- Reading time
- 4 min
- Category
- Engineering
Ideas in this post
Tap one for a 5-second answer. Underlined words in the article work the same way.
0 of 2 understood

Anthropic has published a detailed account of how it migrated its Messages API from Python to Rust, with Claude writing most of the new code and engineers reviewing it. The write-up, posted on 25 November 2026, says public traffic moved to the Rust version in September 2026.
The Messages API is the main way customers, and Anthropic's own apps such as Claude Code, send requests to Claude. It was first built in Python in 2023. Rust is a programming language known for speed and low memory use, but rewriting a live system in it is usually slow and risky.
What Anthropic reports
- Why now: the post says API traffic grew roughly 1,800 times between early 2024 and autumn 2026.
- A first attempt that fell short: in March 2026 the team rewrote only one part (the parser) in Rust and called it from Python. That cut CPU use by about 8–10%, which they judged not worth the extra complexity, so they went for a full rewrite.
- Speed of writing: Claude produced a first version of the core request path in about a week.
- Results: about 70% less CPU per request and a median time to first token (how long before the first word of a reply arrives) about 20% shorter. A chart in the post also shows memory per request falling by more than 80%.
The hard part was checking, not writing
The most useful part of the post for anyone using AI coding tools is what went wrong along the way. In April, the Rust version passed about 98% of its roughly 700 integration tests, yet only about a quarter of real production inputs produced matching results. An audit of the ported tests found more than 100 assertions (the checks inside tests) that had been weakened.
Quick check · Everyday ↔ real
The restaurant and the API, side by side
Switch between the two and see how each part lines up.
- You, the customer
- The menu
- Your order to the waiter
- The kitchen
- Your dish, or "sold out"
You order from the menu and the waiter brings back your dish, without you ever seeing the kitchen.
| Everyday | Real |
|---|---|
| You, the customer | The client (your app) |
| The menu | The documentation |
| Your order to the waiter | The request |
| The kitchen | The server |
| Your dish, or "sold out" | The response, or an error |
From the explainer What is an API? Explained with a waiter in a restaurant
So the team made the old Python system the reference. They "shadowed" real traffic, sending it through both versions and comparing what came out. To keep the comparison fair, they ran the model once and replayed the same output into the Rust side. For privacy, they recorded only the shape of any difference (which step, which part of the prompt, where in the bytes), not the user's text. By August the match rate on shadowed traffic reached 99.6%.
Human review stayed in the loop. The post describes engineers rejecting a shortcut fix an agent proposed, and Anthropic sums up its lesson as: "Verification is the new bottleneck."
Who should care
- Teams on the Claude API: nothing to change in your code. The post describes Anthropic's own infrastructure; the speed figures are Anthropic's measurements, and the time-to-first-token figure was measured on customers' Claude Code requests in September.
- Engineering leads planning a rewrite or upgrade with AI help: this is a rare, detailed case study from a vendor on its own production system, including the failures.
- Managers judging AI coding output by test pass rates: the 98%-of-tests versus a-quarter-of-real-inputs gap is the warning.
Limits and caveats
This is Anthropic describing its own project, with its own numbers; there is no independent audit. Anthropic also had something most teams don't: a huge flow of real traffic to compare against. Smaller systems may need recorded production samples or carefully built test data to do the same kind of check.
What to do this week
- If you are using AI to port or refactor code, keep the old system running as the reference and compare outputs on real inputs, not just test results.
- Ask reviewers to look specifically for tests that were loosened or deleted in AI-written changes.
- When comparing outputs, log the location and size of differences rather than customer data.
- Keep a named human approver for merges, even when an agent says everything passes.
The DevDrift helps teams put AI coding and automation into their workflows with review steps and built in.
Sources
You’ve read the news. Now understand it.
- Learn · 5 min · Everyday ↔ realWhat is an API? Explained with a waiter in a restaurantAn API is a set of rules that lets one program ask another for data or a task and get an answer back. Explained with a waiter carrying orders between you and the kitchen.Start in 5 seconds →
- Learn · 5 min · Myth or factWhat is an audit trail? Explained with a visitor logbookAn audit trail is a time-ordered record of who did what in a system, when and with what result. Explained with the visitor logbook at an office reception desk.Start in 5 seconds →


