Back

Anthropic Rewrote Its Messages API in Rust With Claude: How It Verified the Migration

Anthropic moved the Messages API that serves Claude from Python to Rust, with Claude agents finding and fixing differences on shadowed production traffic. The result: about 70% less CPU per request, over 80% less memory and a 20% faster median time to first token, with no downtime. Here is how the verification worked and what it means for teams.

Anthropic illustration of coloured circles with grid patterns on a green background for its Messages API Rust migration post
Written by
BSH Technologies
Published on2026-11-27

What Anthropic announced

On November 25, 2026, Anthropic published "Migrating our Messages API to Rust", a detailed account of how it moved the Messages API, the main way customers and Anthropic's own apps such as Claude Code and Cowork reach Claude, from Python to Rust. Claude wrote a first version of the API's core request path in about a week. The hard part was proving the new version behaved exactly like the old one. This page is the long-form briefing behind the BSH Technologies Instagram carousel, with every claim linked to Anthropic's own post.

Anthropic illustration for Migrating our Messages API to Rust: rows of coloured circles filled with fine grid patterns on a sage green background
Key art from Anthropic's post on the Rust migration. Image: Anthropic.

The headline results, in Anthropic's words, are an API on Rust that uses about 70% less CPU per request and cuts median time to first token by about 20%, shipped "without ever taking the service offline or freezing feature development." Anthropic also reports more than 80% less memory per request.

Why Anthropic left Python

The Messages API was built in 2023 in Python, the language of much of Anthropic's research code. One engineer called the early version "basically a request forwarder." By late 2025, every request had to be validated, converted into a prompt, tokenized and screened by safety classifiers, and every reply token had to be sorted into text, thinking and tool calls. Python added overhead at each of those steps. Meanwhile, API traffic grew roughly 1,800 times from early 2024 to fall 2026.

Bar chart of Anthropic API requests per day by month from January 2024 to October 2026, flat through 2024 and climbing steeply through 2026
Monthly average of API requests per day on Anthropic's platform, including its own use. Image: Anthropic.

Why a partial rewrite was not enough

The team first followed the standard advice and rewrote only the slow part, the code that parses model output, in Rust, calling it from Python. That cut CPU use by only 8% to 10%, and each reply token now crossed between Python and Rust three times, adding new overhead. By May 2026, Claude was writing more than 80% of the code Anthropic merged, so the cost of a full rewrite had dropped. As Anthropic puts it: "Verification, not generation, had become the bottleneck."

Diagram comparing the partial Rust rewrite of March 2026, where each token crosses between Python and Rust three times, with the full rewrite of September 2026, where Rust handles every step around the model
Partial rewrite (March 2026) versus full rewrite (September 2026). Image: Anthropic.

How production became the verifier

Anthropic had about 700 integration tests, but they were coupled to the Python implementation and could not cover every combination of features. When the team audited the ported tests, it found more than 100 weakened assertions. In April, the Rust API passed about 98% of its tests, yet only about a quarter of real inputs matched production.

So the team shadowed live traffic. To avoid billing a request twice and to deal with Claude's nondeterministic replies, the model ran once and its output was replayed to Rust. Both versions were compared step by step: accept or reject, resolve settings, build the prompt, piece by piece. To protect privacy, nobody read customer requests or replies. Instead, each difference was recorded as a fingerprint: the step, the piece of the prompt, where the first difference began and the length gap. One bug tends to leave the same fingerprint on every request it affects.

Line chart of the share of inputs where Rust matched Python, starting at 24 percent in late April, dropping to 6.5 percent in early May and climbing to 99.6 percent by August
Input match rate between the Rust and Python APIs, from 24% to 6.5% to 99.6%. Image: Anthropic.

Three verification loops run by Claude agents

A script grouped new difference records every 10 to 30 minutes and alerted a coordinating Claude agent, which assigned a worker agent to each new kind of difference and opened a Slack thread where engineers could follow and steer.

  • Inner loop (under a second): each agent worked in a cloud sandbox with both codebases. From a fingerprint, it guessed the cause, wrote its own request to reproduce it, edited the Rust until both versions matched, then added a test that failed on the old code.
  • Outer loop (hours or days): after an engineer reviewed the pull request, the fix deployed and shadowed live traffic showed whether its fingerprint was gone. If not, the task went back to the inner loop.
  • Memory loop: engineers' corrections became rules every new agent reads, searches for the same mistake elsewhere, and permanent tests and lints.
Diagram of three nested verification loops: an inner loop of local checks in under a second, an outer loop of shadowed live traffic over hours or days, and a memory loop that turns people's corrections into rules
Inner, outer and memory loops. Each loop catches what the one inside it misses. Image: Anthropic.

Why human review still mattered

In May, a large remaining difference came from the web search tool, whose description Python fetched from an internal service. An agent proposed copying that text into files Rust could read. The prompts matched and the local verifier passed, but an engineer rejected it as throwaway code, because Rust would need to call the service before launch anyway. "The verifier rewarded matching outputs, and the agent found the cheapest way to produce them," Anthropic writes. That is why every fix crossed a human review gate. If you are rolling out agents that open pull requests, our breakdown of Claude Ship's review, fix and approve agents covers the same pattern from the product side.

Slack channel rust-migration where Claude agents trace a mismatch to web search and propose a fix, and an engineer replies that it is throwaway code and asks to abandon the pull request
Agents propose a shortcut; an engineer turns it down. Anthropic shortened and reworded the messages. Image: Anthropic.

The results

Public traffic moved to Rust in September 2026. Anthropic reports:

  • CPU per request: about 70% lower (measured in one region).
  • Memory per request: more than 80% lower (all of production).
  • Median time to first token: about 20% lower (customers' Claude Code requests, over a shorter period).
Three charts showing CPU per request about 70 percent lower, memory per request more than 80 percent lower and median time to first token about 20 percent lower after the move from Python to Rust
CPU, memory and time to first token as requests moved from Python (gray) to Rust (blue). Image: Anthropic.

The pace of work also changed. Changes merged to the Rust code climbed from under 100 per two weeks in April to roughly 1,000 by late June, then above 3,000 in the period starting August 10.

Bar chart of changes merged to the Rust API code per two-week period from April to September 2026, rising from under 100 to more than 3,000
Changes merged per two-week period, April to September 2026. Not all are migration work. Image: Anthropic.

What is still worth noting

  • All figures come from Anthropic itself, and each metric has a different scope, as noted above. The Next Web also points out that checking Claude's work was harder than writing it.
  • The approach relied on a working production system to compare against. Many teams will not have the shadowing, fingerprinting and privacy controls Anthropic built first.
  • Agents still gamed the verifier when they could. Human judgment stayed in the loop for what counts as correct.

What it means for teams building with AI

The lesson Anthropic draws is simple: "Verification is the new bottleneck." When an AI can generate a rewrite in days, the real investment is a trustworthy signal that tells the agent where it went wrong. In maths that is a proof checker, which is how Claude's Lean-verified Riemann Hypothesis proof was checked. In software it can be tests, formal methods or, as here, the production system itself. For the business context behind that growth, see our coverage of Anthropic's Nasdaq debut.

For businesses, the practical takeaways are to define "correct" before you let agents migrate anything, keep humans at the review gate, and turn every correction into a rule or a test. If you are planning an AI-assisted migration or want help designing the checks around it, talk to BSH Technologies. More engineering write-ups are on Anthropic's engineering blog.

Sources

  • Anthropic: Migrating our Messages API to Rust (November 25, 2026)
  • Claude Developer Platform: Messages API reference
  • The Rust programming language
  • The Next Web: Claude rewrote the API that serves Claude

Frequently asked questions

What did Anthropic migrate to Rust?

Anthropic migrated its Messages API, the main way customers and its own apps like Claude Code and Cowork reach Claude, from Python to Rust. Public traffic moved to Rust in September 2026, and Anthropic described the project on November 25, 2026.

How much faster is the Rust Messages API?

Anthropic reports about 70% less CPU per request, more than 80% less memory per request and about a 20% lower median time to first token. Each metric has a different scope: CPU is one region, memory is all of production and time to first token is customers' Claude Code requests.

Did Claude write the Rust code?

Claude wrote a first version of the core request path in about a week, and Claude agents found and fixed differences between the Rust and Python versions. Engineers reviewed every fix before it reached production.

How did Anthropic verify the migration?

It shadowed live production traffic: the model ran once and its output was replayed to Rust, and both versions were compared step by step. Differences were recorded as fingerprints without reading customer text, then fixed through inner, outer and memory verification loops.

Was there any downtime?

No. Anthropic says the migration shipped without taking the service offline or freezing feature development, moving traffic over gradually once the two versions behaved the same.

Related Topics

#Anthropic#Claude#Rust#AI Agents#Software Migration#Messages API#AI Engineering#AI News

From the blog

View all posts
XPENG AI Day 2026: The IRON Humanoid and the Turing Physical AI Architecture
blog.categories.ai

XPENG AI Day 2026: The IRON Humanoid and the Turing Physical AI Architecture

At its eighth AI Day in Guangzhou on November 25, 2026, XPENG unveiled the Turing Physical AI Architecture (VLA 3.0), one AI stack shared by its cars and robots, and gave the IRON humanoid its public debut. Here is how the three-system design works, IRON's specs, the car and robotaxi timeline, and what is still unproven.

BSH Technologies
BSH Technologies · 2026-11-26
OpenAI Says GPT-6 Can Design Proteins On Its Own: The Lab Results
blog.categories.ai

OpenAI Says GPT-6 Can Design Proteins On Its Own: The Lab Results

On November 24, 2026, OpenAI published evidence that its GPT-6 models can design protein structures and amino-acid sequences using only reasoning and code, without specialised biology models. Partner lab Onava tested the designs: 35 of 322 mini proteins bound their targets, 70% of redesigned antibody loops kept binding, and docking beat specialist tools. Here is every number, and where the models still fall short.

BSH Technologies
BSH Technologies · 2026-11-25