Anthropic Cuts Messages API CPU Use 70% With Rust Rewrite
Anthropic says its Messages API rewrite from Python to Rust cut CPU use 70% per request; engineers deep-read only 2 of 10 agent PRs.
AI SummaryAI
- Anthropic rewrote its Messages API from Python to Rust in five to six months, Lesse said November 25.
- The Rust version uses about 70% less CPU per request, per Anthropic's engineering post.
- Median time to the first returned token shortened by about 20%.
- Messages API traffic grew roughly 1,800-fold between early 2024 and autumn 2026.
Anthropic Rebuilt Its Messages API in Rust
Anthropic has moved the main entry point for Claude requests off Python, cutting the compute cost of every call. Katelyn Lesse, the company's platform engineering lead for the Claude API, said on the November 25 episode of The Pragmatic Engineer, the podcast hosted by Gergely Orosz, that a small team spent roughly five to six months rewriting the Messages API in Rust with heavy assistance from Claude itself. An engineering post the company published the same day put numbers on the result: the Rust version uses about 70% less CPU per request, and the median time to the first returned token is roughly 20% shorter. The service stayed online through the whole migration, and new features shipped on schedule. The Messages API is the route customers and Anthropic's own products, including Claude Code, use to reach the model. Each request is authenticated, turned into a prompt, tokenized and passed through safety classifiers. On the return path the output is split into text, thinking and tool calls, then metered for usage and billing, so every call touches the full sequence. Lesse also described how code review now works: engineers deep-read only about two of every ten pull requests written by AI agents, picking those apart where something has broken. Pull requests are the proposals through which changed code is submitted for review and merged. "As long as you can break a task down into something verifiable, there is no need to read every line of Rust," she said. An internal classifier decides for each PR whether a person should look at it, how many reviewers are needed and which team gets it.
Shadow Traffic and 1,800-Fold Growth
The endpoint dates to 2023, when Anthropic researchers worked mostly in Python and the API was written in that language. The company's engineering post states that traffic grew roughly 1,800-fold between early 2024 and the autumn of 2026, and a global shortage of CPU capacity made it hard to absorb growth by simply adding machines. A narrower first attempt ported only the code that parses model output to Rust; CPU use fell 8% to 10%, but every token had to cross between Python and Rust three times, and the team judged the added complexity not worth carrying. It chose a full rewrite instead. The group had no Rust specialists and had picked Go for a new service a year earlier precisely because its engineers could read it. Claude produced a first version of the core request path in about a week. Verification leaned on shadow traffic: the same production request went to both the Python and Rust versions, with results compared step by step. Because Claude can answer one request in different ways, the team called the model once and replayed that single output to the Rust build. The system never reads request contents; it records only which step diverged and by how many bytes, a design meant to protect user privacy. The Rust version had passed about 98% of tests by April, yet on production traffic only around a quarter of inputs matched exactly. Auditing roughly 700 inherited integration tests, the team found more than 100 loosened check conditions. The Claude Ship beta, launched on November 23, extends the pattern outside the company: external teams can write rules under which Claude approves routine pull requests on their behalf.
The Cost Math Behind the Rewrite
The disclosure reads less as a language story than as a cost story. The company's own figures, 1,800-fold traffic growth and 70% lower CPU per request, show inference providers carrying compute bills that scale with usage, and rewriting the hot path is one of the few levers that moves them materially. The more consequential change sits in review practice: with about 8 of 10 agent pull requests not line-read, and verification pushed into shadow comparison against the live Python baseline, human review labor is being traded for measurement infrastructure. Anthropic did not disclose team size, absolute dollar savings or whether the same method is being applied to other services. Lesse noted the team is phasing out traditional coding interviews as well, testing formats in which candidates review agent-written code instead.
AI-generated, AI-reviewed, under COINOTAG editorial oversight.

