Home · Posts · AI news
AI news

Anthropic Rust API: how Claude helped move the Messages API off Python

By wiredsmarter · · 3 min read

Anthropic Rust API: how Claude helped move the Messages API off Python

The Anthropic Rust API story comes from Anthropic's own engineering post of November 25, 2026. The company moved its Messages API, the service that customers and its own apps like Claude Code and Cowork use to reach Claude, from Python to Rust. Claude wrote a first version of the core request path in about a week. Proving that the new version behaved exactly like the old one took months. The result is about 70% less CPU per request and a median time to first token about 20% faster. An earlier podcast mention put the CPU saving at 40 to 50 percent; the official post says about 70%.

Why Anthropic moved the API to Rust

The Messages API was built in Python in 2023, when it was close to "a request forwarder." By late 2025 every request had to be validated, turned into a prompt, tokenized and screened by safety classifiers, and every reply had to be sorted into text, thinking and tool calls. From early 2024 to fall 2026, API traffic grew roughly 1,800 times. Python added overhead to each of those steps.

A first, partial fix moved only the code that reads the model's output to Rust. It cut CPU use by about 8 to 10 percent, but each token then crossed between Python and Rust three times, so the team went for a full move.

A week to write, months to check

Writing the code was the quick part. The post says that by May 2026 Claude was writing more than 80% of the code Anthropic merged. The slow part was knowing the Rust version was right.

In April the Rust API passed about 98% of its roughly 700 integration tests, yet only about a quarter of inputs matched on real traffic. Real requests hit cases the tests never covered. One example: Python wrote certain characters in tool calls, such as an emoji, as text codes, and Rust wrote them as they were, so the prompts differed by a few bytes. The team also found more than 100 weakened checks in tests that had been ported along with the code.

How they checked it without reading requests

The team ran both versions on the same live requests, ran the model once and replayed its reply to Rust, and compared every step before and after the model call. They could not read customer requests, so each difference was saved as a small record of where it happened and how big it was, never the text.

Agents took those records, guessed the cause, reproduced it in a sandbox and proposed a fix. Engineers reviewed every fix before it reached production traffic. Corrections became written rules, new tests and checks that every later agent followed. Public traffic moved to Rust in September 2026.

What it means if you use Claude

The interface didn't change, so nothing breaks for people building on the API. The time to first token figure was measured on customers' Claude Code requests, so replies there start sooner. Anthropic's own lesson is that checking work, not writing it, is now the slow step when Claude writes the code.

FAQ

Did Claude rewrite Anthropic's API in Rust?

Claude wrote a first version of the Messages API's core request path in about a week. Engineers and agents then spent months checking and fixing it before public traffic moved in September 2026.

How much CPU did the Rust migration save?

Anthropic says the Rust version uses about 70% less CPU per request and cuts median time to first token by about 20%.

Does the Rust move change the Claude API for developers?

No. The post describes the switch as happening without taking the service offline, and the API works the same way for customers.

Sources

Tools in this article

Claude No commission

Anthropic's AI assistant: chat, files, artifacts and the Claude Code app. Free plan; paid plans start with Pro.

Open Claude

We earn nothing from these links. All tools

Making something to sell?

Our guide shows how to make and sell one small PDF with AI, with the real numbers. Chapter 1 is free.

Follow wiredsmarter for the next one

Read next

Checked against official sources on Nov 28, 2026. The character in our posts is made with AI; the text is written with AI help and checked by hand rules.