Flash

Flash·Apps & Agents·2026-11-26 20:08

Anthropic Moves Messages API From Python to Rust, Cutting CPU Use by About 70%

Anthropic published an engineering blog post on November 25 on moving its Messages API from Python to Rust; the new version uses about 70% less CPU per request and cuts median time to first token by about 20%, with public traffic moved in September.

A developer workspace in sunlight, a laptop showing code
A sunny developer workspace with a laptop showing colorful code

What happened

The Messages API was built in 2023 as a simple Python request forwarder, and is the primary way customers — as well as Anthropic's own apps such as Claude Code and Cowork — reach Claude. From early 2024 to fall 2026, API traffic grew roughly 1,800 times, with every request passing through validation, prompt conversion, tokenization and safety classifiers, driving up the cost of the Python version.

Claude wrote a first version of the API's core request path in about a week; by May 2026, Claude was writing more than 80% of the code Anthropic merged, so falling generation costs made a full rewrite possible. The team first tried rewriting only the model-output parsing in Rust, which cut CPU use by only about 8–10% while making each token cross between the two languages three times, failing to justify the added complexity.

The hard part of the migration was verification, not generation: the Python version kept changing during the migration, Claude's replies to the same request are nondeterministic, and the team could not read customer requests. The team turned the production Messages API itself into a verifier, running both versions on shadow traffic, comparing differences item by item, and dispatching Claude agents to fix them; public traffic moved to Rust in September, without ever taking the service offline or freezing feature development.

Key facts

  1. The new version uses about 80% less memory, : alongside about 70% less CPU per request and about 20% faster median time to first token.
  2. The 700 existing integration tests were not enough to verify the migration, : as some were coupled to the Python implementation and passed incorrectly.
  3. The team discussed migration languages internally in 2024, : when one engineer flatly ruled out rewriting the API in Go or Rust.
  4. Shadow-traffic comparison shares no customer content, : with difference records describing only what differed and where.

Why it matters

Claude wrote the core path in about a week, but proving the old and new versions behave the same was the real engineering work, shadow-traffic verification became the migration method, and once generation gets cheap, verification becomes the bottleneck.
Useful Tap if this story helped you
Send to a friendMakes a share image for X, WeChat, Telegram and more

SourcesAnthropic (Nov. 25); InfoWorld (Nov. 25). This article is a compilation of public information and does not constitute investment advice.

From HIMIAO Horizon · himiao.ai

Grab todayAdobe Creative Cloud Pro: 57% off first yearHIMIAO Picks →

Follow HIMIAO Horizon

No sign-up · Unsubscribe any time

Email

Notifications

A ping on your phone or computer when the brief is out. No email needed.

HIMIAO PicksWeekly freebies: one email every Friday, a 5-minute read

Comments

  1. Loading comments…
Ask the cat