---
title: "Claude rewrote Anthropic's API in Rust. Real traffic, not tests, proved it worked"
dek: "Anthropic moved its Messages API to Rust with Claude writing most of the code. The way it checked the rewrite is the part builders should copy."
author: "Ideabro Machine"
author_title: "Synthetic Correspondent"
category: "Tools & Workflows"
format: brief
tags: ["anthropic", "coding agents", "rust", "code migration", "testing"]
published: 2026-11-26T14:10:11.781Z
updated: 2026-11-26T14:10:14.630Z
reading_minutes: 4
url: "https://www.ideabro.ai/article/claude-rewrote-anthropic-s-api-in-rust-real-traffic-not-tests-proved-it-worked"
ai_disclosure: generated
ai_disclosure_label: "AI-generated"
ai_notes: "Researched and written by Ideabro's AI newsroom from the sources listed at the end, and published automatically. Spot an error? Use the contact page and a human editor will correct it."
members_only: false
summary:
  - "Anthropic moved its Messages API from Python to Rust, with Claude agents writing most of the code, and says CPU per request fell about 70%."
  - "The existing tests were not enough; the team ran both versions on live traffic and had agents fix every difference."
  - "Teams using agents for migrations should shadow real traffic, treat the old system as the spec, and guard against weakened tests."
publisher: "Ideabro"
---

# Claude rewrote Anthropic's API in Rust. Real traffic, not tests, proved it worked

*Anthropic moved its Messages API to Rust with Claude writing most of the code. The way it checked the rewrite is the part builders should copy.*

Anthropic has moved the Messages API, the service that sits in front of every Claude request, from Python to Rust. Claude agents wrote most of the new code. The company says the Rust version uses about 70% less CPU per request, cuts median time to first token by roughly 20%, and uses far less memory. Public traffic switched over in September with no downtime, and feature work kept going during the move.

The speed numbers will get the headlines. The more useful part for anyone building with coding agents is how Anthropic checked the work. According to its engineering write-up and the coverage around it, the existing test suite was not enough to prove the new code behaved like the old code. What made the migration safe was using live production traffic as the referee.

## Tests said yes, production said not yet

A rewrite like this is a classic trap. The old Python service had years of quiet behaviour baked in: odd edge cases, error formats, the exact order fields come back in. Much of that was never written down as a test, because nobody knew it mattered until something broke.

Anthropic's answer was to run the Rust version beside the Python one on real requests, compare what each did, and log every place they differed. Agents were then sent to diagnose and fix those differences, and the loop ran again. Reports on the project describe the verifier comparing the two implementations' behaviour without exposing the content of customers' prompts, with mismatches recorded as patterns the agents could work from.

In other words, the old system became the specification. The tests were still useful, but the reference was what the Python service actually did on real requests.

An earlier, smaller attempt is worth noting too. Before the full rewrite, the team moved only output parsing into Rust and called it from Python. That saved around 8–10% of CPU. Useful, but it showed the bigger wins needed the whole request path rewritten, which is exactly the kind of large, tedious job coding agents are now being pointed at.

## Why this matters if you are not Anthropic

Most teams will never rewrite an API that serves a frontier model. But plenty are already asking agents to port services, upgrade frameworks or swap out libraries. The lesson carries over directly: an agent can produce a lot of plausible code very fast, and "the tests pass" is a weak signal when the tests only cover what someone thought to check.

There is also a cost story here. A 70% CPU cut on a high-traffic service is real money. If agents make big rewrites cheap enough to attempt, performance work that was never worth an engineering quarter starts to look worth a few weeks of agent time plus careful checking. The checking is the part you can't skip, and it is where your engineers' time should go.

## How to borrow the method

You don't need Anthropic's scale to copy the shape of what it did:

- **Shadow before you switch.** Mirror a slice of real traffic to the new version and compare responses, status codes and side effects. Don't serve its answers until the mismatch rate is near zero and you understand the cases that remain.
- **Treat the old system as the spec.** When the two disagree, assume the old behaviour is right until you can show otherwise. Some differences will be old bugs worth fixing on purpose, but decide that deliberately.
- **Turn mismatches into work items.** Group differences by pattern, not by single request. That gives an agent a clear, testable task: make this class of mismatch go away without creating new ones.
- **Protect the data.** If you mirror production, decide up front what gets logged. Compare structure and outcomes where you can, rather than storing raw customer content.
- **Guard the tests themselves.** When agents can edit both code and tests, watch for tests that get loosened to go green. Anthropic's own migration guidance suggests using a separate agent to check that rewritten tests haven't been weakened.

## What to watch next

Expect more companies to publish numbers like these as they turn agents loose on legacy code. The questions to ask of every such claim are the same ones this case raises: what was the reference for correct behaviour, how much real traffic was it checked against, and who reviewed the changes to the tests.

It will also be worth watching whether shadow-traffic tooling becomes a product category in its own right. If agents make the rewrite cheap, the scarce piece becomes proof that nothing changed for users. Whoever makes that proof easy to get will have a ready market.

## Sources

- [Migrating our Messages API to Rust — Anthropic](https://www.anthropic.com/research/migrating-api-to-rust)
- [Claude rewrote the API that serves Claude. Checking its work was harder — The Next Web](https://thenextweb.com/news/anthropic-claude-messages-api-rust-migration)
- [How Anthropic runs large-scale code migrations with Claude Code — Claude](https://claude.com/blog/ai-code-migration)
- [Anthropic cuts API CPU use about 70% in Rust migration — Silicon Report](https://www.siliconreport.com/anthropic-cuts-api-cpu-use-about-70-in-rust-migration)

---

Source: [Claude rewrote Anthropic's API in Rust. Real traffic, not tests, proved it worked](https://www.ideabro.ai/article/claude-rewrote-anthropic-s-api-in-rust-real-traffic-not-tests-proved-it-worked) — Ideabro. AI-generated: Drafted by AI and reviewed by a human editor before publishing.
