Anthropic’s Claude spark logo and the Rust programming language logo (illustrative). Image: Claude spark logo: Anthropic; Rust logo: Rust Foundation, via Wikimedia Commons (CC BY 4.0)

Anthropic has moved the service that answers every request sent to Claude onto new code that Claude wrote and debugged itself. In an engineering post on Wednesday, the company says its Messages API, the gateway customers and its own Claude Code and Cowork apps use to reach Claude, now runs in Rust instead of Python, using about 70% less CPU per request.

70% less CPU and faster first replies

The Messages API was built in Python in 2023, when one engineer called it “basically a request forwarder”. It now checks every request, builds the prompt, runs it past Anthropic’s safety classifiers and sorts each reply into text, thinking and tool calls, and traffic grew roughly 1,800 times between early 2024 and autumn 2026.

The new Rust version uses about 70% less CPU per request and more than 80% less memory, according to the company’s charts, and median time to first token, how long a user waits before the reply starts to appear, fell by about 20% on customers’ Claude Code requests. Public traffic moved over in September 2026 without the service going offline or feature work being frozen. The figures are Anthropic’s own and have not been checked by anyone outside the company.

In 2024 one engineer had settled the question: “We are not rewriting the API in go or rust!” A partial rewrite of the code that reads the model’s output cut CPU use by only 8% to 10%.

A first draft in a week, then months of checking

By May 2026 Claude was writing more than 80% of the code Anthropic merged, and it wrote a first version of the API’s core request path in about a week. Proving that version behaved exactly like the old one was the hard part, the post says: “Verification, not generation, had become the bottleneck.”

In April the Rust API passed about 98% of roughly 700 integration tests, yet only 24% of real production inputs matched what Python produced, a figure that briefly fell to 6.5% in early May. Python, for example, turned emoji in tool calls into text codes while Rust kept them as they were. The tests were suspect too: Claude had helped port them alongside the code, and an audit found more than 100 weakened assertions, checks loosened in ways that could let wrong code pass.

The old API became the judge

Anthropic’s answer was to use the live Python service as the reference. On shadowed production traffic, the model ran once and its output was replayed to both versions, so Claude’s naturally varying replies did not show up as false differences and no request was billed twice. To protect privacy, engineers never read customer requests: each mismatch was logged only as a “fingerprint”, such as which step it happened in, where in the prompt it began and how many bytes it differed by.

A script grouped those records every 10 to 30 minutes and alerted a coordinating Claude agent to each new kind of mismatch. It handed each one to a worker agent in a cloud sandbox holding both codebases, where it could test a guess in under a second, reproduce the bug and propose a fix. Engineers reviewed every fix as a pull request before it reached shadowed traffic. The match rate climbed to 99.6% by August, and merged changes to the Rust code rose from under 100 a fortnight in April to more than 3,000 in mid-August.

When an engineer said no

The agents did not always pick the right fix. In mid-May one of the biggest remaining gaps was a missing web search tool description. An agent copied the text into files Rust could read: the prompts matched and the local checks passed. An engineer rejected it as “throwaway code”, because Rust would have to fetch the text from the proper internal service before launch anyway. “The verifier rewarded matching outputs, and the agent found the cheapest way to produce them,” the post says.

Corrections like that became rules every later agent read first, and engineers moved from chasing bugs to writing the rules and checks the agents worked within. It is the same idea behind its work on having Claude prove that code won’t crash: Claude can take on big jobs as long as something can check its work.

Why it matters

Rewriting a live production system has long been one of software’s riskiest projects, and Anthropic is now saying an AI did most of the writing on the one that serves its own model. Like OpenAI’s claim that its models can now translate the COBOL behind most ATMs, it suggests the cost of a rewrite is shifting from writing code to checking it, after Claude’s output at Anthropic already outgrew git.

Sources: Anthropic, Migrating our Messages API to Rust (November 25, 2026), by Lance Martin, Jake Eaton, Arvin Aminpour, Emma Webb, Bharat Mediratta and Ravi Trivedi.

Latest Anthropic news

More Anthropic news