Two server pipelines, one grey and one blue, meeting at a checkpoint gate

Anthropic Rewrote the Claude API in Rust — and Used the Live API to Check It

Anthropic Rewrote the Claude API in Rust — and Used the Live API to Check It

The Anthropic Messages API Rust migration is done, and the way Anthropic checked it matters as much as the speed gain. In a research post published on 25 November 2026, Anthropic says it rewrote the Messages API — the main route customers, Claude Code and Cowork use to reach Claude — from Python to Rust, without taking the service offline or freezing new features. Anthropic reports about 70% less CPU per request and about 20% lower median time to first token. Claude wrote the first version of the core request path in about a week. Checking that version against the live system took months.

That gap is the story. Writing the replacement was the fast part. Proving it behaved like the original, on live traffic Anthropic cannot read, was the slow part. The same API sits behind everyday Claude use, including the tools in the Claude interactive connectors guide and the Claude computer use rollout. How you call the API does not change.

What Anthropic changed

The Messages API is how software talks to Claude. A customer sends a structured list of messages, and the model generates the next message back. Anthropic built the API in 2023 in Python, when it mostly passed requests to the model and returned the reply. One engineer at the time called it “basically a request forwarder.”

By late 2025, the job had grown. Anthropic says every request had to be validated, converted into a prompt, tokenised and screened by safety classifiers. Replies then had to be sorted into text, thinking and tool calls as they streamed back, and Python added overhead at each step. Traffic made it worse: Anthropic reports API traffic grew roughly 1,800 times from early 2024 to autumn 2026.

Rust was the answer Anthropic picked for lower CPU use per request. The hard question was whether a full rewrite could be trusted on a live system where customers depend on edge cases tests never covered.

The numbers Anthropic reports

FigureWhat Anthropic reportsScope
CPU per requestAbout 70% lessOne production region, per Anthropic’s charts
Median time to first tokenAbout 20% lowerCharted Claude Code requests
Traffic growthRoughly 1,800 timesEarly 2024 to autumn 2026
First core-path versionAbout one weekWritten by Claude; verification took months

The CPU figure comes from one production region in Anthropic’s charts. The time-to-first-token figure is a median measured on Claude Code requests. Both are Anthropic-reported results on its own system, with no independent benchmark. The post measures the API path, not end-to-end chat speed for every Claude product or plan.

Why the first attempt fell short

Anthropic did not start with a full rewrite. The first attempt rewrote only the output-parsing code in Rust and called it from Python. Anthropic reports that cut CPU use by about 8% to 10%. That sounds useful until you look at the cost. Each token now crossed between Python and Rust three times, and each crossing added overhead of its own.

What changed the decision was Claude itself. Anthropic says that by May 2026, Claude was writing more than 80% of the code the company merged. Writing a full Rust version had become cheap. The open problem moved: how do you prove the new version matches the old one when the old one keeps changing? New models and features shipped throughout, so the target moved while Anthropic aimed at it. Verification had become the bottleneck.

How the Anthropic Messages API Rust rewrite was checked without reading your requests

A data request flowing through three server stages with magnifier checkpoints
Checkpointing compared each stage of a request, so the first difference pointed at the code that caused it. Illustration created with Muse’s built-in image generator, not a screenshot.

The usual checks were not enough, and Anthropic says so directly. The suite held about 700 integration tests, tied to the Python code: they ran the Python API inside the test process and faked services such as billing in Python’s memory. When the tests were ported, an audit found more than 100 weakened assertions. The tests were also incomplete. Anthropic gives the scale: 20 binary options make over a million combinations, about 12 days of testing at one second each, for one model, before anyone varies the prompts.

April showed the gap in one pair of numbers. Anthropic reports the Rust API passed about 98% of its tests that month, yet matched only about a quarter of production inputs. One example cause was small. When Python writes JSON tool calls, it escapes certain characters, such as an emoji, as text codes. Rust wrote those characters as they were. The prompts differed by a few bytes, and a few bytes are enough to change a reply.

So Anthropic used the production system itself as the checker. Live requests ran through the Python API as normal, and the Rust version worked on the same traffic in shadow. The model ran once, and its output was replayed to the Rust side, so a customer was never billed twice and Claude’s habit of answering the same request differently could not fake a mismatch. Every stage before and after the model call was then compared, step by step.

Privacy shaped the rest. Anthropic could not read customer requests or replies, so the system recorded the shape of each difference. Checkpointing compared each stage of a request — accepted or rejected, settings resolved, prompt built — and the first stage that differed pointed at the code behind it. Fingerprinting recorded where in the prompt a difference began and how long it was, so one bug left the same pattern on every request it touched. Difference records could then be grouped by pattern.

Three loops and the human gate

Three linked loops for sandbox, shadow and memory verification
A fast sandbox loop, a slower shadow-traffic loop and a memory loop that saved each correction as a rule. Illustration created with Muse’s built-in image generator, not a screenshot.

Fixes ran through three loops. The inner loop gave each agent a sandbox with both codebases and fast local checks. An agent guessed a cause from a difference pattern, wrote its own request to reproduce it, and edited the Rust code until both versions matched. A check that never called the model took under a second. The outer loop checked approved fixes against shadowed production traffic. The memory loop saved each correction as a rule for every later agent. In June, Anthropic says, an agent grouped about 60 review comments into proposed rules, and an engineer edited and approved them for the team’s CLAUDE.md file.

Human review stayed the gate between the sandbox and production, and one rejected fix shows why. In mid-May, the largest remaining difference came from web search: the production API fetched the web search tool’s description from an internal service, and the Rust version did not call that service yet. An agent proposed copying the description text into files Rust could read. The prompts matched. The local check passed. An engineer rejected the fix anyway, because Rust would still need the real service call before launch. A checker can prove two outputs match. It cannot judge whether the fix is worth shipping.

Scale ran in the background. Anthropic says a script grouped new difference records every 10 to 30 minutes and alerted a coordinating agent only when a new kind of record appeared. Each new kind got its own worker agent and a Slack thread where engineers could steer. The agents did the chasing. Engineers spent their time on proposed fixes and on the questions no checker could answer.

What it means for Claude users and builders

For API users, the practical answer is short: nothing to do. The Messages API keeps the same shape, and Anthropic presents the rewrite as a change underneath it. The developer guide and reference linked below describe the same requests as before. Anthropic announced no price change in the post, and this article makes no claim that API prices fell because of Rust.

For builders, the reusable part is the checking pattern. Anthropic’s account suggests a sequence any team with a live system can study: run the old and new versions on the same real traffic, record differences without exposing private data, give agents a fast place to reproduce each difference, and keep a human gate on what ships. The limit is equally clear. Building the difference signal took much of the effort. A team without a production system it can shadow does not get this pattern for free.

One question stays open. Anthropic says ambitious migrations are now limited mainly by how fast results can be verified. Whether smaller teams can build a verifier as good as this one, without Anthropic’s traffic volume or agent setup, is unanswered. If you run a live service, start there: before planning the rewrite, work out how you would prove the new version matches the old one on real traffic. If you cannot answer that, the rewrite is not ready to start.

Did Anthropic take the Claude API offline to rewrite it in Rust?

No. Anthropic says the migration shipped without ever taking the service offline or freezing feature development. The Rust version was checked against live production traffic in shadow while the Python API kept serving customers.

How much faster is the Rust Messages API?

Anthropic reports about 70% less CPU per request in one production region, per its charts, and about 20% lower median time to first token on charted Claude Code requests. Both figures are Anthropic-reported on its own system, with no independent benchmark.

Did Claude write the whole API by itself?

Claude wrote a first version of the core request path in about a week, according to Anthropic. Months of verification followed, with agents proposing fixes in a sandbox and engineers reviewing them before anything reached production. Human review stayed the ship gate.

Does this change what Claude API users have to do?

No action is needed. The Messages API keeps the same shape, and the rewrite sits underneath it. Anthropic announced no price change in the post, so do not read lower CPU use as a promise of lower API prices.

Why was running the test suite not enough?

Anthropic had about 700 integration tests, but they were tied to the Python code and incomplete: 20 binary options alone make over a million combinations. In April the Rust API passed about 98% of its tests yet matched only about a quarter of production inputs, which is why live traffic became the checker.

Sources: Anthropic, Migrating our Messages API to Rust (25 Nov 2026); Using the Messages API, Claude Platform Docs; Create a Message, Claude API Reference. All performance figures are Anthropic-reported. Last checked: 27 Nov 2026.

More Guides for Manga Artists