Anthropic migrates Messages API to Rust with Claude, cutting CPU 70%

Anthropic migrates Messages API to Rust, cutting CPU usage per request by roughly 70% and reducing median time to first token by about 20%. The engineering team detailed the Python-to-Rust transition—carried out with Claude agents and without taking the service offline—on Wednesday (November 25, 2026) on the official Anthropic blog.

Why Anthropic moved from Python to Rust

Originally built in Python in 2023, the Messages API serves as the main gateway for external customers and Anthropic's own apps, including Claude Code and Cowork. Between early 2024 and fall 2026, API traffic grew roughly 1,800 times, turning Python's per-token overhead across validation, tokenization, and safety classifiers into a bottleneck.

An incremental rewrite of output parsing in March 2026 trimmed CPU usage by 8% to 10%, but added complexity because each token crossed between Python and Rust three times. By May 2026, Claude was writing over 80% of the code Anthropic merged, enabling it to draft the core Rust request path in about a week.

Verifying parity in production

Verification—not code generation—proved to be the hardest hurdle, as Claude's replies are nondeterministic and Anthropic does not read customer requests. To solve this, the team turned the live Python API into an oracle:

  • Privacy-preserving fingerprints: Step-by-step checkpointing recorded only byte offsets and length mismatches without exposing user text.
  • Inner sandbox loop: Claude agents reproduced issues locally in under a second before opening pull requests.
  • Outer loop & human review: Engineers reviewed PRs before deploying them against shadowed live traffic.
  • Memory loop: Review feedback became permanent rules (including in CLAUDE.md), lints, and regression tests.

Public traffic officially shifted to Rust in September 2026 with zero downtime or feature freezes.

By Spark