Anthropic

Anthropic rebuilt the Messages API in Rust — 70% less CPU per request, 20% faster first token

Anthropic has moved the Claude Messages API from Python to Rust, rewriting the core request path with Claude itself. Traffic has grown about 1,800x since early 2024; the rewrite uses roughly 70% less CPU per request and delivers the median first token about 20% faster — with the API contract unchanged.

Anthropic has migrated the Claude Messages API from Python to Rust, rewriting the core request path that handles every Claude API call — a service that has grown about 1,800x in traffic since early 2024. Claude wrote the first draft of the core request path in about a week, and by May 2026 it had written more than 80% of the merged code; engineers remained in the loop, scoping work, reviewing changes and re-doing key pieces such as timeout and caching behaviour by hand.

The rewrite was verified against live production traffic: shadow comparisons, an inner loop running the same request through both implementations and an outer loop driving real user traffic, plus a memory loop to capture the quirks — such as retrying client-side stream errors — that only production reveals. The result is about 70% less CPU per request and a median time to first token about 20% faster, with the API contract unchanged for callers. Anthropic says the work matters beyond one endpoint: it is the pattern for using Claude to migrate the remaining internal systems that still run on Python.

Read the original · Anthropic

Share