Claude helped Anthropic move its Messages API from Python to Rust, cutting CPU per request by about 70%

· Anthropic

Claude helped Anthropic move its Messages API from Python to Rust, cutting CPU per request by about 70%

Anthropic rewrote the API that serves Claude in Rust, with Claude writing the first version of the core request path in about a week. Checking the rewrite was the hard part: it used live traffic as the test and AI agents to fix mismatches, with engineers reviewing.

Key numbers

What happened

On 25 November 2026, Anthropic described how it moved its Messages API, the main way customers and its own apps such as Claude Code reach Claude, from Python to Rust without taking the service offline or pausing feature work. Public traffic switched to Rust in September 2026.

Source: Anthropic — Migrating our Messages API to Rust

~70%less CPU per request
~20%faster median time to first token
~1 weekfor Claude's first draft of the core path

Why rewrite at all

API traffic grew roughly 1,800 times from early 2024 to fall 2026, and Python added overhead at every step of a request. Rewriting just the output parser in Rust saved only 8–10% of CPU, because each token then crossed between the two languages three times. By May 2026 Claude was writing more than 80% of the code Anthropic merged, so a full rewrite became realistic.

"Verification, not generation, had become the bottleneck." — Anthropic

Checking the rewrite

Takeaway: an AI can write a large rewrite quickly, but trusting it needs tests that can't be quietly weakened and a comparison against real behaviour.

Source: https://www.anthropic.com/research/migrating-api-to-rust

Tags: Agents, Anthropic, Claude, Rust, Software engineering

Read on AI Gist