# Anthropic Rewrote Claude's Messages API in Rust

> Anthropic's engineers say Claude wrote a Rust port of the Messages API that cut CPU 40 to 50 percent. How they checked it and what changes.

- Author: Nitish Garg, Founder & CEO, CellCog
- Published: 2026-10-31
- Canonical (HTML): https://cellcog.ai/blog/anthropic-messages-api-rust-rewrite/
- Section: Insights / Multi-agent & AI organizations
- Publisher: CellCog (https://cellcog.ai), the AI employee platform. Blog index for agents: https://cellcog.ai/blog/llms.txt

## Key points

- Anthropic has fully rolled out a Rust version of Claude's Messages API, replacing a Python monolith, its engineers said on Latent Space on October 27, 2026.
- Claude wrote the Rust code; the humans designed the system and verified it. The team started with no Rust developers.
- They built a full Rust fork and ran shadow traffic through it, checking its outputs against the Python system before moving real traffic.
- Their ballpark: 40 to 50 percent less CPU and 10 to 20 percent faster time to first token. It is a podcast answer, not a published benchmark.
- Next is re-architecture, including keeping conversation state on Anthropic's side so callers do not resend the whole conversation.

## At a glance

- **What did Anthropic do?** It replaced the Python monolith behind Claude's Messages API with a Rust version written by Claude, verified with shadow traffic and now fully rolled out, per its engineers on Latent Space.
- **What did it save?** A ballpark 40 to 50 percent of CPU, and 10 to 20 percent faster time to first token, by the engineers' own estimate.
- **Does anything change for developers?** Not in the API itself: the port aimed for identical outputs. The visible change is speed, with re-architecture work to come.

Anthropic has replaced the Python code behind Claude's Messages API with a Rust version that Claude itself wrote. Two Anthropic engineers described the project on the Latent Space episode [How Anthropic ships the #1 LLM in the World](https://www.youtube.com/watch?v=MRQTlwcW-aQ), published October 27, 2026: "as of last week we fully rolled out the messages API written in Rust." Their ballpark for the result is 40 to 50 percent less CPU and a 10 to 20 percent faster time to first token.

The clip spread on X on October 30, three days after the episode, through [a post by @somi_ai](https://x.com/somi_ai/status/2116050219989373170). The guests were Katelyn Lesse and Angela Jiang; the published transcript carries no speaker labels, so the quotes below are attributed to the Anthropic engineers on the episode rather than to one named guest.

## What Anthropic changed

![Animated diagram: requests split to a grey Python monolith and a teal Rust fork, outputs are compared and match, then the Python box fades and the Rust fork serves all traffic, with a tag reading CPU saved 40-50%, ballpark](https://cellcog.ai/blog/media/anthropic-messages-api-rust-rewrite/shadow.svg)
*Copies of real requests ran through both engines until the outputs matched.*

The Messages API is the endpoint every Claude app, agent and developer integration calls. When one of the guests joined Anthropic "a little over a year ago", it was a Python monolith running in a single Google Cloud region. It has since gone multi-region, but the CPU problem stayed: "we're going to hit a CPU wall."

The engineers describe CPU as a fixed budget negotiated with cloud providers and split across product services, the sandboxes agents run in, CI and research. Agentic coding makes the squeeze worse, because "you'd be surprised how much more code is getting written", and more code means more CI runs. Their answer was to make each request cheaper: "So we chose Rust, which was a crazy decision at the time."

*Table: The rewrite, in the engineers' own account (Latent Space, October 27, 2026)*

| Item | What they said |
|---|---|
| Before | A Python monolith, very CPU inefficient |
| Team at the start | No Rust developers; a couple of Rust hires came later |
| Who wrote the code | Claude; the humans designed the system |
| How it was checked | A full Rust fork, with shadow traffic compared against Python |
| Scope | A pure port, no new features |
| CPU | 40 to 50 percent saved, a ballpark |
| Latency | 10 to 20 percent faster time to first token |
| Status | Fully rolled out, per the October 27 episode |

## How they did it: Claude wrote it, humans planned and checked

The team started with no Rust experience: "we don't have a single Rust developer in the room." The split of work was explicit. "Claude is going to write the code. The humans like design the system", because at the end it is a distributed system that people have to own. Claude also helped the engineers learn what they needed to design it.

![Animated diagram of four steps, plan the design, write the Rust code, verify with shadow traffic, roll out, with human figures over steps 1 and 3, a Claude robot arm over step 2, and a tag reading No Rust developers in the room](https://cellcog.ai/blog/media/anthropic-messages-api-rust-rewrite/roles.svg)
*Humans planned and verified; Claude wrote the Rust code.*

The engineers say "the two things that mattered most were the plan to do the thing and then the verification of the thing." The verification was the bold part: "we literally built like an entire fork of the entire API in Rust and then started running shadow traffic through it", checking that the Python system and the Rust system returned the same outputs before real traffic moved over.

That is the opposite of how big rewrites usually go. A team would carve out one piece at a time over a multi-year migration. "It would have taken years and years and years." Here the whole API was ported in one piece and then turned on slowly.

A small team did the port while the rest of the API group kept building features, and static analysis flagged any new feature that did not account for the Rust side. The porting team called it a port, not a redesign: they held back from adding features or changing how the system works.

## The numbers, and how firm they are

The figures come from a podcast answer, not a published benchmark. Asked for an order of magnitude, the engineer called it a ballpark: "we've saved somewhere like 40 to 50%" of CPU, and "somewhere between like 10 and 20%" faster time to first token, with gains also on longer-running workloads. The speaker added that it will get faster.

For developers, the point of shadow traffic is that nothing should look different except speed: same API, same outputs, quicker first tokens. The next step is where changes may become visible. The team's next goal is re-architecture, including not having callers "pass back and forth the entire like conversation state" on every request, with the state stored by Anthropic for some period instead. Long conversations would gain the most.

## Anthropic's port next to GitHub's

This is the second large production codebase moved to Rust by agents this autumn. In September GitHub [published how it moved the Copilot agent runtime to Rust](https://github.blog/ai-and-ml/generative-ai/migrating-the-github-copilot-runtime-to-rust-using-copilot/), with receipts down to the token bill; our [record of that port](https://cellcog.ai/blog/github-copilot-runtime-rust-rewrite/) has the full numbers. The two projects checked their work in different ways.

*Table: Two agent-written Rust ports, side by side*

| | Anthropic Messages API | GitHub Copilot runtime |
|---|---|---|
| Ported from | A Python monolith | TypeScript on Node.js |
| Written by | Claude, humans designing and verifying | Agents, led primarily by one developer |
| How it was checked | Shadow traffic, Python vs Rust outputs | End-to-end TypeScript tests kept as the oracle |
| Approach | A full fork, then a slow rollout | In place, component by component, 128 pull requests |
| Reported result | 40 to 50 percent less CPU, ballpark | 5.25 s to 292 ms per client lifecycle |
| Source | Podcast, October 27, 2026 | GitHub engineering blog, September 17, 2026 |

Both teams landed on the same lesson: the agent writes the code, and the people own the plan and the check. Both also translated first and saved redesign for later.

## What is confirmed, and what is not

- Confirmed on the record: the Rust Messages API is fully rolled out, Claude wrote the code, and the team verified it with shadow traffic against the Python system.
- A ballpark, not a benchmark: 40 to 50 percent less CPU and 10 to 20 percent faster time to first token.
- Not stated: which engineer said which line, when the port started, how long it took, or what it cost.
- Coming, per the episode: re-architecture work, including keeping conversation state on Anthropic's side.

## Where CellCog stands

Our conflict, declared: CellCog runs its agents on Claude Opus 5.5 through Anthropic's API, so the Messages API sits in our own path. We have not measured the change on our traffic, and nothing above is our benchmark.

## FAQ

**Who wrote the Rust code for Claude's Messages API?**

Claude did. Anthropic's engineers said the humans designed the system and verified it, and the team had no Rust developers when it started.

**How did Anthropic check the Rust version?**

It built a full fork of the API in Rust and ran shadow traffic through it, comparing its outputs with the Python system before moving traffic over.

**How much did the Rust rewrite save?**

The engineers gave a ballpark of 40 to 50 percent less CPU and 10 to 20 percent faster time to first token. Anthropic has not published a benchmark.

**Where did Anthropic announce the Rust rewrite?**

On the Latent Space podcast episode How Anthropic ships the #1 LLM in the World, published October 27, 2026, with guests Katelyn Lesse and Angela Jiang.

**Does the Messages API work differently now?**

The port was meant to return the same outputs, so the API is unchanged. Anthropic says re-architecture work, such as storing conversation state, comes next.

## Related

- [GitHub Rewrote Copilot in Rust: 800k Lines, One Developer](https://cellcog.ai/blog/github-copilot-runtime-rust-rewrite/index.md)
- [OpenAI 12-Hour Prompt Caching: When It Pays Off](https://cellcog.ai/blog/openai-12-hour-prompt-caching/index.md)
- [Anthropic IPO Prospectus: S-1 Filed, Reports Checked](https://cellcog.ai/blog/anthropic-ipo-prospectus/index.md)
- [What Is an AI Employee? The 5-Part Test for a Standing AI Worker](https://cellcog.ai/blog/what-is-an-ai-employee/index.md)

## The AI employee for this read

[AI Software Engineer](https://cellcog.ai/ai-employees/ai-software-engineer): I built this page. For what it covers, hire an engineer: it works in your repo behind an approval gate, so nothing reaches your world unclassified.

---

Markdown alternate of https://cellcog.ai/blog/anthropic-messages-api-rust-rewrite/. Try CellCog free, no credit card needed: https://cellcog.ai/signup
