Claude API Rust: two identical engines run side by side, the new orange one mirroring the old one step by step (AI image)

Illustration

Companies3 min read

Anthropic moves Claude Messages API to Rust, cutting CPU use by 70%

Anthropic has migrated its Claude Messages API from Python to Rust, the company said in an engineering post. CPU use per request fell by about 70% and median time to first token by about 20%, Anthropic says, without taking the service offline or freezing feature development.

Key facts

  1. Anthropic has migrated the Messages API, the route to Claude for customers, Claude Code and Cowork, from Python to Rust.
  2. According to Anthropic, CPU use per request fell by about 70% and median time to first token by about 20%.
  3. API traffic grew roughly 1,800 times from early 2024 to autumn 2026; the rewrite took about five months, according to The Pragmatic Engineer.

Manfred „Luigi“ LugmayrBy Manfred „Luigi“ Lugmayr

Researched and written with AI, to Luigi's brief, positions and editorial rules. Automatically checked against the sources. How I work →

The Messages API is the main way customers reach Claude, according to Anthropic, and the company's own apps Claude Code and Cowork use it too. From early 2024 to autumn 2026, traffic grew roughly 1,800 times. Rust lets the service use far less CPU per request, the company says.

Claude wrote a first version of the core request path in about a week, the post says. The harder part was proving that the Rust version behaves like the production Python version. The Python API kept changing during the migration, Claude can answer the same request differently each time, and Anthropic could not read customer requests.

Claude API: production traffic as the verifier

Anthropic therefore turned the production Messages API itself into the verifier. It tested the Rust version on live traffic, tracked down differences and automatically dispatched agents to fix them. The Pragmatic Engineer newsletter describes this as shadowing: the new API ran alongside the old one until the responses matched.

Anthropic had first rewritten only the code that parses model output in Rust and called it from Python. That cut CPU use by about 8% to 10%, but the gain did not justify the complexity, Anthropic says, because each token now crossed between Python and Rust three times.

Katelyn Lesse, who leads platform engineering at Anthropic, told the newsletter the rewrite took about five months, with a few engineers and no Rust experts. There were no strict code reviews, and Lesse estimates engineers looked closely at only around 20% of the generated code. She also cited a global CPU shortage that makes extra capacity hard to get. OpenAI's API was also first written in Python and later rewritten in Rust, the newsletter says.

Why the API started in Python

Anthropic built the API in Python in 2023 because its research code was mostly written in Python, the company says. A simple “request forwarder” grew into a service that validates requests, turns them into prompts, tokenises them and runs them through safety classifiers. By May 2026 Claude was writing more than 80% of the code Anthropic merged, the company says.

The sources do not say whether customers need to change anything in their integrations. Anthropic points to its Messages API documentation.

Analysis

The figures come from Anthropic itself. According to the chart caption, the CPU numbers cover one region, and the time-to-first-token figure covers customers' Claude Code requests over a shorter period. Still, the report matters for companies that want to let AI into production systems: generating code was not the bottleneck here, verifying it was. Anthropic had a running Python API as a reference that exposed every difference.

That supports a rule for first agent projects: the job should be clearly bounded and end in a result someone can judge. Without a reference, a fast agent helps little. AI does not repair unclear ways of working, it makes missing yardsticks more visible. Teams that let agents touch websites, campaign set-ups or data flows should define in advance what “identical” means and keep the sign-off with people. Anthropic itself concedes that engineers looked closely at only a fraction of the code. That worked because the check ran on production traffic. The approach carries over to marketing systems only where a comparable reference exists.

More Anthropic news this week: Claude Ship lets agents review and approve code, MCP gets Tasks and Elicitation for agents, Microsoft turns on Claude in Copilot for EU firms and Claude Artifacts as desktop apps.

  • Share

Got AI news? Submit news →

FAQ

Why did Anthropic move the Messages API to Rust?

Traffic grew roughly 1,800 times, and Python added overhead to every request, Anthropic says. Rust needs far less CPU per request, according to the company.

How much faster is the Claude API after the migration?

Anthropic says median time to first token fell by about 20% and CPU use per request by about 70%.

Source

Anthropic: Migrating our Messages API to Rust

More sources

  • The Pragmatic Engineer – Belegt Dauer von rund fünf Monaten, kleines Team ohne Rust-Experten, Shadowing, Schätzung von Katelyn Lesse zu rund 20 Prozent genau geprüftem Code, CPU-Knappheit, Vergleich mit OpenAI.

Black Friday 2026

Black Friday deals on AI tools, straight to your inbox.

I collect the AI tool deals worth having and send them in the AI Briefing, along with the AI news that matters, every Wednesday and Friday. Five minutes to read.

  • Black Friday deals on AI tools, collected for you
  • The key AI news, briefly explained
  • Wednesday and Friday, unsubscribe in one click

In the AI Briefing right now

Image for the story: 13 AI tool Black Friday deals checked; three offer real savingsDeal13 AI tool Black Friday deals checked; three offer real savings
Image for the story: Anthropic moves Claude Messages API to Rust, cutting CPU use by 70%NewsAnthropic moves Claude Messages API to Rust, cutting CPU use by 70%
Image for the story: Google Deepmind has AI agents run experiments for the next GeminiNewsGoogle Deepmind has AI agents run experiments for the next Gemini
Blonde woman with glasses smiling as she scrolls on her phone in an office

Manfred “Luigi” LugmayrFrom Manfred “Luigi” Lugmayr: 30 years in marketing, seven of them as CMO at burgerme.