AI • Technology • Digital InnovationIdeas, tools and guides for the future
AI GAME CHANGER PRO
Discover AI. Explore Technology. Create More.

Claude Rebuilt Its Own API in Rust — 70% Less CPU, 20% Faster Replies, Zero Downtime

November 26, 2026 • Ai Game Changer


I have read a lot of AI announcements this year, but this one stopped me. Anthropic just explained, in a detailed engineering post published on 25 November, how it moved the Messages API — the service through which every Claude request flows — from Python to Rust. Claude itself wrote most of the new code. The result: about 70% less CPU per request and a median time to first token about 20% shorter, with no downtime and no freeze on new features. If you use the Claude API, Claude Code, or Cowork, this is the plumbing underneath your work, and it just got a lot faster.

Why the old API ran out of road

Anthropic built the Messages API in 2023 as a simple Python service. One engineer at the time called it basically a request forwarder: a request came in, went to the model, and the reply went back out. Then Claude got popular. From early 2024 to the fall of 2026, traffic through the API grew roughly 1,800 times. Every request now has to be validated, turned into a prompt, tokenised, and screened by safety classifiers, and every reply has to be sorted into text, thinking, and tool calls as it streams back. Python added overhead to every one of those steps, and the service was built for a world that no longer exists.

The team tried the cautious route first. They rewrote just the part that parses model output in Rust and called it from Python. That saved about 8% to 10% of CPU — but each token then crossed between Python and Rust three times, and the extra complexity was not worth the gain. In 2024, when someone suggested a full rewrite, another engineer shut it down in one line: we are not rewriting the API in Go or Rust. Two years later, the maths had changed, because the cost of writing code had collapsed. By May 2026, Claude was writing more than 80% of the code Anthropic merged. A full rewrite was suddenly affordable. The question was no longer whether Claude could write it. It was whether anyone could prove the new version behaved exactly like the old one.

The real story: verification, not generation

This is the part I think matters most, and it is the part most coverage will skip. Anthropic is blunt about it: verification, not generation, had become the bottleneck. Claude wrote a first version of the API's core request path in about a week. Proving it correct took months, from April until public traffic switched over in September 2026.

The existing test suite could not do the job. Anthropic had about 700 integration tests, and the Rust version passed about 98% of them by April. But when the team compared the two versions against real production traffic, only about a quarter of inputs produced an identical prompt. The tests were coupled to the Python implementation, so a pass could mean the code was right — or that a test had been changed to let wrong code through. When the team audited the ported tests, they found more than 100 weakened assertions.

So the engineers turned the production API itself into the verifier. They ran live traffic through both versions at once — a technique called shadowing — but with three twists. First, they ran the model once and replayed its output to both versions, so a customer was only billed once and nondeterministic replies could not create false alarms. Second, they compared every step before and after the model call, so a deviation could be pinned to the exact place it happened. Third, they never read customer requests or replies: they recorded only the shape of each difference, where it happened and how big it was, grouping identical diffs by fingerprint so one bug did not flood the queue with hundreds of thousands of identical records.

Then came the loops. A script grouped new kinds of diffs every 10 to 30 minutes and woke a coordinating Claude agent, which assigned worker agents to fix them. A fast inner loop let agents test ideas in a sandbox and fail safely, with checks that ran in under a second because they never called the model. A slower outer loop validated fixes against production. A memory loop recorded mistakes so agents could learn from them. And humans stayed in charge of the important gate: every fix still needed a human-approved pull request. That gate mattered. In one case an agent fixed a missing web search tool description by copying the text into local files — the prompts matched, the verifier was happy, and an engineer rejected it as throwaway code.

What this means if you build on the Claude API

For most of us, the practical effect is simple: Claude Code and API calls should feel snappier, with replies starting about a fifth sooner, and Anthropic's serving costs drop sharply, which is the kind of saving that eventually shows up in pricing or capacity. But there is a bigger lesson here for anyone building with AI coding agents, and it is one I keep coming back to in my own work: generating code is now the cheap part. The expensive part is proving the new code does exactly what the old code did. Anthropic's answer — measure parity on real traffic, not on test pass rates — is worth stealing for your own migrations, even small ones. A green test suite told them they were 98% done when production traffic said they were 25% done. That gap is where real bugs live.

There is also a quiet milestone hiding in this story. The company that builds Claude used Claude to rebuild the system that serves Claude, and the hardest part of the job was building trust in the result. That is where AI-assisted engineering is heading: not agents writing code unsupervised, but agents doing the writing while humans and verification systems own the proof. If you run an API of your own, or you are planning a rewrite you have been putting off for years, this post is the closest thing to a playbook I have seen. I have linked Anthropic's full write-up below, and it is worth your time.

For more on making your own API calls cheaper, I wrote earlier about two small Gemini API changes that stop your agent paying for tools it never uses. And if you want to see what Claude agents can already do inside a codebase, here is my guide to Claude Ship, the agents that review, fix and approve pull requests.

Sources: Anthropic — "Migrating our Messages API to Rust" (25 November 2026) · InfoWorld — "Anthropic says it moved its Claude API from Python to Rust with no downtime".