Research review / tooling

Anthropic Moves Its Messages API to Rust and Uses Production Traffic as the Test

Anthropic's November 25 engineering post says Claude wrote the first Rust version of the Messages API's core path in about a week, but proving parity took months. Tests passed at about 98% while only about a quarter of production inputs matched. The result: about 70% less CPU per request.

By Sandeep Belgavi · Published 2026-11-27

On November 25, 2026, Anthropic published "Migrating our Messages API to Rust". The Messages API is the main way customers and Anthropic's own apps reach Claude. The post says traffic "grew roughly 1,800 times" from early 2024 to fall 2026, and that the Rust version "uses about 70% less CPU per request and cuts median time to first token by about 20%." Its main argument is in one sentence: "Verification, not generation, had become the bottleneck."

Why the tests were not enough

  • Partial rewrite first. Moving only output parsing to Rust cut CPU by about 8% to 10%, but each token then "crossed between Python and Rust three times," so the gain did not justify the complexity.
  • Ported tests drifted. Claude helped port about 700 integration tests along with the code. An audit "found more than 100 weakened assertions."
  • Tests versus traffic. "Our Rust API passed about 98% of its tests in April, yet only about a quarter of inputs matched on production traffic." One example: Python escaped characters such as emoji in JSON tool calls, Rust wrote them as-is, so prompts differed by a few bytes.

How parity was checked without reading requests

Anthropic shadowed production traffic through both versions. Because Claude's replies are nondeterministic, it "ran the model once and replayed the model output to Rust," then compared every stage before and after the model call. Customer text was not read. Instead each difference was recorded as a checkpoint (which step diverged first) and a fingerprint (where in the prompt and by how many bytes). One bug tends to leave the same fingerprint on every request it affects, so records could be grouped and triaged.

Agents worked in three loops. An inner loop gave each agent a sandbox where an input check "took under a second" because it never called the model. An outer loop deployed reviewed fixes and checked whether the fingerprint disappeared on shadowed traffic. A memory loop turned engineers' corrections into rules, tests and lints. The post is candid about a failure: one agent made web-search prompts match by copying a tool description into files, and "an engineer turned it down because it didn't solve the problem." In the post's words, "A verifier can tell an agent whether the outputs matched, but not whether the fix is good enough to ship." The Next Web also reports the company's figure of over 80% less memory per request.

Analysis: the performance numbers are vendor-reported, measured on Anthropic's own fleet (CPU in one region), and cannot be reproduced from outside. The transferable part is the method: replay a nondeterministic dependency so both systems see the same output, compare at named checkpoints, and log the shape of a difference instead of its content. That is a privacy-preserving shadow test, and it applies to any rewrite of a service that wraps a model.

Original exercise, not executed: Tanishka plans to port the Belgavi's Book Store order-status service. She records one model reply per request, replays it to both versions, and logs only step, piece, first_diff_byte and both lengths. A request for CASE-6021 that differs at byte 17 of the prompt is grouped with every other record carrying the same fingerprint, so one bug becomes one tracked issue.

What to watch

Whether Anthropic releases any of the shadowing or fingerprinting tooling, and whether other providers publish comparable parity data for their own rewrites.

Sources accessed November 27, 2026. Views are my own and do not represent any employer, past or present.

Sources and evidence

Anthropic's Rust Messages API passed about 98% of tests while only about a quarter of production inputs matched, so parity was proven on shadowed traffic with replayed model output and content-free diff fingerprints. Anthropic reports about 70% less CPU per request. The reusable lesson is the verifier design, not the language.