Industry & Business

Anthropic rewrote the API that serves Claude in Rust, and used Claude agents to check the work

Anthropic says it moved its Messages API from Python to Rust, using the live service and teams of Claude agents to check the new code. It reports about 70% less CPU per request and 20% faster first tokens.

Thick black power cables entering a raised server room floor, no people, logos or readable text
AI-generated · Source

The API behind Claude now runs on code largely written by Claude. “We recently migrated our Messages API from Python to Rust,” Anthropic posted on X on Wednesday, pointing to an engineering post on “how we used the existing service to verify the new one, with teams of Claude agents tracking down and fixing differences between the two versions.”

Why move at all

In the engineering post, Anthropic says the Messages API, built in Python in 2023, had become the main way customers and its own apps such as Claude Code reach Claude. It says API traffic grew roughly 1,800 times between early 2024 and fall 2026, and that every request now has to be validated, tokenised and screened by safety classifiers. Python added overhead at each step.

Background

Earlier stories on this thread.

What happened next

No later story on this thread is on the site yet. New files are listed on Anthropic reporting.

The hard part was checking

Anthropic says Claude wrote a first version of the core request path in about a week. Trusting it was harder: the Python service kept changing during the migration, and Claude can answer the same request differently each time, so a mismatch between outputs did not always mean a bug.

The company’s answer was to turn the production API itself into a verifier, run the Rust version against real traffic, find where it differed, and automatically dispatch agents to fix those differences.

The result

Anthropic says the Rust API “uses about 70% less CPU per request and cuts median time to first token by about 20%,” and that it shipped “without ever taking the service offline or freezing feature development.” Those are the company’s own figures.

The broader lesson in the post is about verification. Generating a migration is now fast, Anthropic argues; proving it behaves the same is the bottleneck, and that is where the agent teams earned their keep.

This report is not legal, financial, or health advice. See the disclaimer.

Primary sources

  1. Anthropic on X: We recently migrated our Messages API from Python to Rust Anthropic on X
  2. Migrating our API to Rust Anthropic

Tags