█

AI/TLDR

Anthropic · 2026-11-25 · major

Anthropic moves its Messages API to Rust — 70% less CPU per request

In short

Anthropic rewrote its Messages API from Python to Rust, mostly with Claude, and checked it against shadowed production traffic. CPU per request fell about 70%, memory over 80%, and median time to first token about 20%.

Anthropic · 2026-11-25 · 2 sources checked

Anthropic article card for Migrating our Messages API to Rust

Anthropic explains how Claude agents ported its main API to Rust, with live traffic as the test.

Quick facts

What movedMessages API, Python → Rust
CPU per requestabout 70% lower
Memory per requestmore than 80% lower
Median time to first tokenabout 20% lower
Production match rate24% at first, 99.6% by August
Public traffic on RustSeptember 2026

What is it?

Anthropic's engineering post 'Migrating our Messages API to Rust' describes how the company moved the API behind Claude, Claude Code and Cowork from Python to Rust. Public traffic switched in September 2026 without downtime or a freeze on new features.

How does it work?

A coordinating Claude agent gave each new kind of mismatch to a worker agent. Workers tested ideas in sandboxes, fixes were then checked on shadowed production traffic, and reviewer corrections were turned into rules, tests and lints. Engineers stepped in between the inner sandbox loop and the outer production loop.

Why does it matter?

The authors argue that verification, not code generation, is now the limit on large migrations. Merged changes to the Rust API grew from under 100 per two weeks to more than 3,000, which shows what a strong verifier lets agents do on their own.

Who is it for?

backend teams planning large rewrites with coding agents

Frequently asked questions

Why did Anthropic rewrite the Messages API in Rust?
Anthropic built the Messages API in Python in 2023, and its job grew to include validation, prompt building, tokenization, safety screening and output parsing. Traffic grew roughly 1,800 times from early 2024 to fall 2026, and Python's per-step overhead became a problem. A first Rust port of only output parsing cut CPU by about 8% to 10%.
How much of the Rust migration did Claude write?
Anthropic says Claude wrote the first version of the core request path in about a week, and by May 2026 Claude wrote more than 80% of the code the team merged. Claude agents also diagnosed and fixed the differences between the Python and Rust versions, and helped port the test suite, while engineers reviewed the fixes.
How did Anthropic check the Rust API without reading customer data?
Anthropic shadowed production traffic: the model ran once and its output was replayed to both the Python and the Rust API. Each mismatch was stored only as a checkpoint, such as the step, the first differing byte and the lengths, plus a fingerprint used to group bugs, so engineers never had to read customer requests or replies.
Why were tests not enough for Anthropic's Rust port?
Anthropic's Rust port passed about 98% of its roughly 700 integration tests in April, yet only 24% of real production inputs matched at first. The team found over 100 test assertions had been weakened during porting, and the tests could not cover the feature combinations customers actually use. Production traffic became the main verifier.

Sources · 2 outlets

Tags

  • anthropic
  • claude
  • rust
  • python
  • migration
  • messages-api
  • coding-agents
  • verification
  • differential-testing
  • infrastructure
// NEVER MISS A RELEASEGet every AI release the moment it shipsFree Telegram channel · 1-line TLDRs · no emailJoin on Telegram

← All releases · Learn AI