ROHAN TECH OFFICIAL • Technology • AI • Apps • Tutorialsinfo@rohantechofficial.com
ROHAN TECH OFFICIALTechnology • AI • Apps • Tutorials • Digital World
Home → Tech News → Anthropic Rebuilt Its Claude Messages API in Rust With Claude’s Help

Anthropic Rebuilt Its Claude Messages API in Rust With Claude’s Help

By Rohan Jaspal • November 26, 2026 • Updated November 26, 2026
Anthropic Rebuilt Its Claude Messages API in Rust With Claude’s Help

Anthropic has rebuilt the Messages API — the service that connects customers and its own apps to Claude — from Python to Rust, and Claude did most of the writing. The company laid out the project in an engineering post on November 25, and the numbers are hard to ignore: about 70% less CPU per request, over 80% less memory, and a median time to first token roughly 20% faster.

The rewrite went live for public traffic in September 2026, without taking the service offline or freezing feature development. The interesting part is not that an AI wrote the code. It is how Anthropic proved the new version behaved exactly like the old one — a problem the team says turned out to be far harder than writing the code itself.

Why the API needed a rewrite

Anthropic built the Messages API in 2023 as a fairly simple Python service. One early engineer called it basically a request forwarder. Then Claude took off. From early 2024 to fall 2026, API traffic grew roughly 1,800 times, and every request now has to be validated, turned into a prompt, tokenised and screened by safety classifiers before it reaches the model.

The team first tried a partial rewrite in March 2026, moving only the response-parsing code to Rust. That cut CPU usage by about 8% to 10% — not enough to justify the added complexity of running two languages. A full rewrite was the obvious answer, but the effort looked huge. Anthropic is not the only lab treating safety as a first-class system — OpenAI and Cisco’s Shirudo applies the same thinking to Linux security.

Then the economics changed. By May 2026, Claude was writing more than 80% of the code Anthropic merged, so the cost of producing a first version of the new API dropped fast. Claude wrote a first version of the core request path in about a week. Writing the code, the engineers wrote, was no longer the hard part.

Verification was the real project

Proving the Rust API matched the Python one was where the work piled up. The team had about 700 existing integration tests, but they were tied to the Python implementation, and an audit found more than 100 weakened assertions in the ported tests. In April, the Rust API passed about 98% of its tests — yet only about a quarter of real production inputs produced matching behaviour.

The problems ran deep. The Python API kept changing throughout the migration as new models and features shipped, so “correct” was a moving target. Claude’s replies are nondeterministic, so two different outputs did not necessarily mean a bug. And some 20 binary options in the API produce over a million combinations to check.

Anthropic’s answer was to turn the production Python API into the answer key. Live requests ran through both versions, but the model was called only once and its output replayed to the Rust service, so customers were never billed twice and randomness could not create false mismatches. To protect privacy, engineers never read the actual requests or replies — they recorded only the shape of each difference.

Two ideas did most of the work: checkpointing, which compared each step of a request to find where the versions first split, and fingerprints, which logged where a difference began and how big it was, so one bug could be told apart from another. Around that, the team built three agent loops: a fast inner loop where agents reproduced bugs in a sandbox and fixed the Rust code in seconds, a slower outer loop that checked fixes against shadowed production traffic, and a memory loop that turned engineer corrections into permanent rules.

A coordinating Claude agent grouped new mismatch records every 10 to 30 minutes, assigned a worker agent to each bug, and opened a Slack thread so engineers could follow along. Human review still gated every merge. The share of matching inputs rose from about 24% in late April to 99.6% by August, and the bugs the process caught included a 1-million-token context limit being read as 200,000 and a missing tool description.

What it shows

“Verification, not generation, had become the bottleneck,” the Anthropic engineers wrote — and that line is the real story here. AI coding tools can now produce a first draft of a production system in days. Trusting that draft with live traffic is the slow part, and Anthropic’s answer was to let agents do the checking too, with humans setting the rules and reviewing the results.

It is the same pattern Anthropic is shipping to customers: Claude Ship sends agents to work on pull requests, and the company keeps finding that the checking matters more than the writing. The Rust migration is the strongest evidence yet that the approach scales to a system millions of people depend on. Read Anthropic’s engineering post and the InfoWorld report for the full account.