News

How Anthropic made Claude’s Messages API faster with Rust

Anthropic reports a shorter wait for the first token in Claude Code after moving the Messages API to Rust. The team used live traffic to check how the new service behaved.

Oliver · FoxAI World3 min read
18
Oliver sits at an Anthropic-branded laptop beside server stacks, a Rust logo and paired checklists.Claude’s move to Rust

Conceptual cover created with AI.

When you stream a response from Claude, the wait for the first piece of output is the first delay you notice. Anthropic says that wait fell by about 20 percent at the median for customer requests from Claude Code after it moved the Messages API from Python to Rust. The company moved public traffic in September 2026 without taking the service offline and published its account on 25 November.

Why Anthropic rewrote the API

The Messages API is the interface software uses to send requests to Claude and receive its replies. It checks the request, prepares the input for the model and processes the output as it arrives. Anthropic says traffic grew roughly 1,800-fold from early 2024 to autumn 2026. Its first attempt moved only the code that parses the model’s output to Rust and reduced processor use by about 8 to 10 percent. But each output token, a small unit of model output, crossed between the two languages three times. Each handoff added work.

After the full move, Anthropic measured about 70 percent less processor use per request in one region. The Claude Code latency figure measures the start of the response. Streaming delivers the response in pieces, so time to the first token and time to the finished reply answer different questions.

Oliver holds a magnifying glass at an Anthropic-branded laptop, between Python and Rust server stacks.
AI-generated conceptual illustration.

Passing tests left many differences undetected

In April, the Rust service passed about 98 percent of its tests. Only around a quarter of inputs matched when the team compared actual traffic. In one case, Python represented an emoji in tool-call data with an escape sequence, a text code standing for the character. Rust kept the character itself. Both forms can represent the same emoji, but the bytes sent to the model differed. A request could still succeed even though Claude received a slightly different prompt.

One model run gave both paths the same output

Anthropic ran the old and new paths side by side on live requests. Claude can give different replies to the same input, so the team ran the model once and replayed its output through Rust. That also kept each request counted once for limits and billing. The team compared intermediate results without reading customer requests or responses. It grouped recurring differences by details such as where they started and how large they were. Input agreement reached 99.6 percent on the traffic compared.

Engineers decided which fixes should go live

Claude wrote an initial version of the core request path in about a week. Later, agents tested fixes in isolated environments using requests they wrote themselves. Engineers reviewed the changes before live traffic could show whether the mismatch had disappeared. Review decisions also became rules for later agents. One engineer turned down a fix that copied a missing tool description into a file. The local check passed, but the service still needed to fetch that description from its usual source.

For a team attempting a similar migration, I’d budget time for a comparison that pinpoints where behaviour changes. The copied description shows why. Even with a precise comparison, a passing check can leave the underlying work unfinished.

Ask AI about this article

Opens in a new tab with the question filled in.

Sources and research

Written by FoxAI World. The cover and illustrations are AI-generated conceptual artwork.

Your favourites

This list stays in this browser on your device. No account is needed, and other visitors cannot see it.

Use a story’s bookmark button to add your first favourite.