On a sage-green background, two groups of colored circles filled with a black grid, in green, blue, orange, red, purple, gray, and pink. This is the title artwork from Anthropic's post Migrating our Messages API to Rust.
Title artwork from Anthropic's post Migrating our Messages API to Rust. Re-encoded as WebP from the original 16:9 frame., Anthropic

要点

  • Lance Martin, Jake Eaton, Arvin Aminpour, Emma Webb, Bharat Mediratta, and Ravi Trivedi wrote the post on 25 November 2026, with editorial guidance from Caitlin Love. It says the Messages API moved from Python to Rust without taking the service offline or freezing feature development. From early 2024 to fall 2026, API traffic on Anthropic's own platform, including its own use, grew roughly 1,800 times.
  • The post's efficiency results are about 70% less CPU per request and about 20% lower median wait to the first token. Figure 15 also labels memory used per request as more than 80% less. The caption says the lines are seven-day averages, and that 100 is about the level just before the move. CPU is one region, memory is all of production, and the wait-time chart is customers' Claude Code requests over a shorter period. Public traffic moved to Rust in September 2026.
  • The team first rewrote only the output-parsing step in Rust and called it from Python. That cut CPU use by about 8% to 10%, but each token of a reply crossed between Python and Rust three times. The post says those gains did not justify the extra complexity. In 2024, after one engineer suggested moving to Go or Rust, another answered, We are not rewriting the API in go or rust!
  • By May 2026, the post says, Claude was writing more than 80% of the code Anthropic merged. Claude wrote a first version of the core request path in about a week. In April 2026 the Rust API passed about 98% of its tests, yet only about a quarter of inputs matched on production traffic. Figure 6 plots that input match rate starting at about 24%, falling to 6.5% in early May, then rising after a label that reads Fixes roll out, and reaching 99.6% in August. The post says each dot is a day, the line is a seven-day median, what was compared changed over time, and six misleading days are left out. Replies were compared separately.

On 25 November 2026, Anthropic published an engineering post on migrating its Messages API from Python to Rust. The company said the new service uses about 70% less CPU per request, meaning less processor time for each call, and cuts the median wait until the first token of a reply appears by about 20%, without taking the API offline or freezing feature work. The harder claim in the post is not the change of programming language. It is the gap the authors also report: passing tests was not the same as matching production.

[1]

The Messages API is the main way customers reach Claude, and the way Anthropic's own apps reach it as well. The post names Claude Code and Cowork. Anthropic built the API in 2023 in Python. One engineer at the time called it basically a request forwarder. Traffic later grew far beyond that design. The post says that from early 2024 to fall 2026, API traffic on Anthropic's own platform, including its own use, grew roughly 1,800 times.

By late 2025, the service was doing more than forwarding. Each request had to be checked, turned into a prompt the model could read, split into tokens, and run through safety classifiers. As the reply streamed back, tokens had to be sorted into text, thinking, and tool calls. The post says Python added cost at each of those steps, each time it created an object, freed memory, or handed work to the next task.

The team first rewrote only the output-parsing step in Rust and called it from Python. That cut CPU use by about 8% to 10%. It also made each token of a reply cross between Python and Rust three times. The post says those gains did not justify the extra complexity. In 2024, after one engineer suggested moving to Go or Rust, another temporarily settled the question: We are not rewriting the API in go or rust!

By May 2026, Anthropic said Claude was writing more than 80% of the code the company merged. Claude wrote a first version of the core request path in about a week. The remaining problem was trust. The Python API kept changing while the migration was under way, so the definition of correct moved with it. Claude can also give different replies to the same request, so a difference between two outputs was not automatically a bug. The team said it could not read customer requests, which made it harder to see where the two versions diverged.

[1]
A line chart of how often Rust and Python matched on the input path. The rate is about 24% in late April 2026, falls to 6.5% in early May, then rises after a label that reads Fixes roll out, and reaches 99.6% in August. The green line is a seven-day median; light green dots are single days. A diagram at the top says the comparison is on the input path; the output path was compared separately.
Figure 6 from the Anthropic post: input-path match rate on production traffic. The authors say what was compared changed over time, and that six misleading days are left out. Re-encoded as WebP at the original wide proportions., Anthropic

The company already had about 700 integration tests. Those were not enough for this migration. The tests ran the Python API inside the test process and mocked other services, such as billing and rate limiting, in Python memory. The tests had to change along with the code, and Claude helped with both. When the tests were ported, an audit found more than 100 weakened assertions. A pass could mean the code was right, or that the test had been loosened. The tests were also incomplete. The post notes that just 20 binary options make more than a million combinations, which would take 12 days at one second each, for one model, before the prompts inside them are varied.

In April 2026, the Rust API passed about 98% of its tests, yet only about a quarter of inputs matched on production traffic. Figure 6 plots that input match rate. The chart starts at about 24%, falls to 6.5% in early May, then rises after a label that reads Fixes roll out. It ends at 99.6% in August. The post says each dot is a day, the line is a seven-day median, what was compared changed over time, and six misleading days are left out. Replies were compared separately. One early mismatch was small: when Python wrote JSON tool calls, it escaped some characters, including an emoji, as text codes, while Rust wrote the characters as they were, so the two prompts differed by a few bytes.

To compare the two versions on live traffic, the team ran the model once and replayed that same model output to Rust. That avoided billing a request twice, and it avoided treating Claude's ordinary variation as a bug. They compared each step before and after the model call. They did not read user text. Instead they recorded the shape of each difference: which step, which piece of the prompt, the first byte that differed, and the two lengths. They called that a fingerprint. A script ran every 10 to 30 minutes, grouped similar records, and alerted a coordinating Claude agent only when a new kind of record appeared. Worker agents then tried to reproduce the difference in a sandbox, using requests they wrote themselves, so they could read both results. A fix moved on to a comparison against live traffic only after a pull-request review. A memory loop stored reviewers' corrections as rules. In June, an agent grouped about 60 review comments, which an engineer edited and approved for CLAUDE.md.

The headline efficiency numbers appear in the prose and again in Figure 15. The figure labels CPU used per request as about 70% less, memory used per request as more than 80% less, and median wait to the first token as about 20% less. The caption says the lines are seven-day averages, 100 is about the level just before the move, CPU is one region, memory is all of production, and the wait-time chart is customers' Claude Code requests over a shorter period. Public traffic moved to Rust in September 2026.

[1]
Three charts of the move from Python to Rust. The left chart shows CPU used per request, labeled about 70% less, from August to October. The middle chart shows memory used per request, labeled more than 80% less, over the same months. The right chart shows median time to first token, labeled about 20% less, with dates August 24, September 7, and September 21. Gray is Python; blue is Rust.
Figure 15 from the Anthropic post. The caption says CPU is one region, memory is all of production, and the wait-time chart is customers' Claude Code requests over a shorter period. Re-encoded as WebP at the original wide proportions., Anthropic

The more cautious reading is that a full rewrite was still a risk, and that the team's first instinct in 2024 was not to do it. They tried the incremental path, got an 8% to 10% CPU cut, and only then argued for a complete move. The 70% and 20% figures, and the memory drop shown on the chart, are Anthropic's own production metrics, not an independent audit. Figure 6 is also already edited: six days were left out, and the comparison itself changed over time. Other teams may not have a live service they can use as a checker, a way to compare versions without reading user text, or engineers who write the rules that later agents must follow. The post shows how this migration was done. It does not show that any large live system can now be rewritten the same way.

[1]

Over the next six months, the figures to recheck are whether the CPU, memory, and wait-time improvements in Figure 15 still hold after more feature work lands on the Rust API, and whether later public metrics still use the same scope: one region for CPU, all of production for memory, and Claude Code traffic for the latency chart. Watch whether Anthropic publishes the residual mismatch rate after the September cutover, against the 99.6% input match shown for August, and whether other companies migrating live APIs report a similar gap between test-suite pass rates and production match rates. If the efficiency gains shrink once the old Python service is gone, the comparison baseline will have moved. If later incident reports show customer-visible divergences that the comparison missed, the limits of a fingerprint that omits user text will be clearer.

【No.2】

[1]