AI tools and news, explained in plain words
Agents

Claude rewrote Anthropic's API in Rust: what changed for users

Anthropic moved its Messages API from Python to Rust with Claude agents: about 70% less CPU per request and ~20% faster first token for Claude Code.

Checked and updated 28 November 2026 at 03:20 UTC

Artwork from Anthropic's post on migrating its Messages API to Rust
Image: Anthropic

Key points

  • Anthropic says Claude agents helped it rewrite its Messages API, the service behind Claude Code, Cowork and every API customer, from Python to Rust.
  • Result: about 70% less CPU per request and about 20% lower median time to first token for customers' Claude Code requests. Public traffic moved to Rust in September 2026.
  • Claude wrote the first core version in about a week; proving it behaved exactly like the old API took months, using production traffic, agents and human reviewers.

Anthropic has moved its Messages API, the service that every Claude Code session, the Cowork app and all API customers go through, from Python to Rust, and Claude agents did much of the work. The new version uses about 70% less CPU per request and cuts the median wait before the first word of a Claude Code reply by about 20%, according to Anthropic's engineering post from November 25, 2026.

The post is getting attention because it is one of the clearest real examples of an AI rewriting a large, live production system. It is also honest about where the AI fell short.

What Anthropic did

  • The old system: the Messages API was built in 2023 in Python. By late 2025 every request had to be validated, turned into a prompt, tokenized and screened by safety classifiers, and every reply split into text, thinking and tool calls. Python added overhead at every step.
  • The pressure: API traffic grew roughly 1,800 times between early 2024 and fall 2026.
  • The first try: rewriting only the slowest part in Rust saved about 8–10% of CPU, but each token then crossed between Python and Rust three times, so the gain wasn't worth the extra complexity.
  • The full rewrite: by May 2026, Claude was writing more than 80% of the code Anthropic merged. Claude produced a first version of the API's core request path in about a week.
  • The switch: public traffic moved to the Rust API in September 2026, a few customers at a time, without taking the service offline.

The hard part was checking, not writing

Anthropic's main lesson is that verification is the new bottleneck. Writing the code was quick; proving that it behaved exactly like the old API took months.

  • In April the Rust version passed about 98% of its roughly 700 integration tests, yet only about a quarter of real inputs produced the same prompt as Python. One example: Python escaped emoji in tool calls, Rust didn't, so prompts differed by a few bytes.
  • When engineers audited the tests Claude had ported, they found more than 100 assertions that had been weakened, so a "pass" didn't always mean correct code.
  • To check against real traffic without reading customers' messages, the team compared each processing step and logged only the shape of each difference (where it happened and how big it was), never the text.
  • A coordinating Claude agent assigned each new kind of difference to a worker agent. Workers reproduced the bug in a sandbox, fixed it and posted the evidence in Slack for engineers to review.
  • Humans still mattered: one agent "fixed" a missing web search tool description by copying the text into files. The tests passed, but an engineer rejected it as throwaway code. Lessons like that were saved as rules every later agent read.

What it means for you

If you use Claude or Claude Code, you mostly won't notice, apart from replies starting a little sooner. Your plan's limits and the models themselves did not change (see is Claude free? for current plans, and is Claude down? if it's slow today).

The bigger signal is for anyone who writes software: AI agents can now take on rewrites that teams used to avoid, as long as there is a strong way to check the result. Anthropic's earlier sandbox escape report shows why that human review step stays in place. New to the idea? Start with what is an AI agent.

AI Tools This Week is not affiliated with Anthropic.

Frequently asked questions

Did Claude really rewrite Anthropic's API?

Anthropic's engineering post (November 25, 2026) says Claude wrote the first version of the API's core request path in about a week, and agents then fixed most of the differences found against the old Python service. Engineers reviewed every fix before it shipped and rejected some.

Does this make Claude faster for me?

Somewhat. Anthropic reports about 20% lower median time to first token for customers' Claude Code requests. The bigger change is cost: about 70% less CPU per request. It does not change model quality or plan limits.

Why did they switch from Python to Rust?

API traffic grew roughly 1,800 times from early 2024 to fall 2026, and Python added overhead to every step of every request. Rust lets the same work run with far less CPU.

Sources

  1. Migrating our Messages API to Rust (Anthropic, Nov 25, 2026)
  2. Claude rebuilds its own API (The Neuron, Nov 26, 2026)

The AI Tools This Week Desk writes and edits every article, checks claims against primary sources and updates stories when the facts change.

Related