Anthropic has migrated its Messages API from Python to Rust, reducing CPU usage per request by approximately 70% and memory consumption by more than 80%. The engineering overhaul, completed in September 2026 and publicly detailed on November 25, demonstrates how the company is using its own AI model, Claude, to modernise critical software infrastructure while improving performance and efficiency.

One of the most interesting aspects of the project is that Claude helped write more than 80% of the code involved in the migration. The AI model produced the first version of the new API’s core request-processing system in approximately one week. However, preparing the software for production required months of testing, debugging and human engineering oversight. The project highlights how AI coding agents are changing software development, with verification increasingly becoming more important than simply generating code.

Why Anthropic Replaced Python With Rust

Anthropic originally built its Messages API using Python in 2023. At the time, the service primarily forwarded customer requests to its AI models and returned their responses.

However, the API gradually became more complicated as Claude gained additional capabilities and attracted more users.

The Messages API now handles several important operations, including:

  • Validating incoming requests.
  • Converting messages into model-ready prompts.
  • Tokenising input data.
  • Running safety classifiers.
  • Processing streaming responses.
  • Separating text, reasoning and tool calls.
  • Managing logging, metrics and billing-related operations.

These additional responsibilities increased the computational overhead associated with processing every request.

Anthropic reported that API traffic grew approximately 1,800 times between early 2024 and autumn 2026.

As usage expanded, the company needed a more efficient architecture capable of handling significantly larger workloads without continuously increasing infrastructure requirements.

Rust offered a potential solution because of its performance characteristics and memory-management capabilities.

Why Rust Can Be More Efficient Than Python

Python is one of the most widely used programming languages for artificial intelligence, data science and backend development.

Its simplicity, extensive libraries and developer-friendly syntax make it particularly useful for building applications quickly.

However, Python can introduce additional runtime overhead in computationally intensive systems.

Rust takes a different approach. It is a compiled programming language designed to provide high performance while maintaining memory safety without relying on a traditional garbage collector.

Its advantages include:

1. Lower runtime overhead

Rust programs are compiled into machine code, allowing them to execute many operations with less runtime overhead than typical Python implementations.

2. Efficient memory management

Rust uses an ownership and borrowing system that helps developers manage memory safely and efficiently.

3. Better control over system resources

Developers can optimise how memory, CPU resources and concurrent operations are handled.

4. Strong performance for backend infrastructure

Rust is particularly useful for services that process large volumes of requests and require predictable performance.

For Anthropic, these characteristics made Rust an attractive choice for rebuilding the Messages API.

Claude Helped Write More Than 80% of the New Code

The migration is also an example of Anthropic using its own AI technology to improve the infrastructure behind its products.

According to the company’s engineering report, Claude wrote the first version of the API’s core request-processing path in approximately one week.

The AI model also helped identify differences between the original Python implementation and the new Rust version.

Anthropic said Claude was writing more than 80% of the code it merged by May 2026.

This allowed engineers to undertake a project that would traditionally have required substantially more manual programming effort.

However, generating code was only one part of the challenge.

The new API needed to behave almost identically to the original system. Even small differences could affect customer requests, tool calls, streaming responses or other functionality.

The company therefore developed an extensive verification process before directing production traffic to the Rust implementation.

Why Testing the AI-Generated Code Took Months

Anthropic discovered that producing a working version of the new API was significantly easier than proving that it behaved correctly under real-world conditions.

The original Python API continued receiving new features while the Rust migration was underway. This meant the target system was constantly changing.

Another complication was that AI model responses are not always deterministic. Identical requests can sometimes produce different outputs, making it difficult to identify genuine software errors through simple comparisons.

Anthropic also could not freely inspect customer request content because of privacy requirements.

To address these challenges, the engineering team developed a verification system based on production traffic.

The process involved sending requests through both the original Python API and the new Rust implementation, then comparing how the two systems processed them.

This approach allowed engineers to identify differences without needing to read customers’ private messages.

Claude agents could then investigate individual mismatches, propose fixes and test their changes.

Human engineers reviewed the important changes before they were accepted.

Anthropic Used Shadow Traffic to Verify the Migration

One of the most important techniques used in the project was shadow traffic.

Shadow traffic involves sending copies of real production requests through a new system without allowing that system to affect the actual customer experience.

Anthropic used this technique to compare the behaviour of the Python and Rust implementations.

The verification process involved several layers.

Verification methodPurpose
Shadow trafficCompare both implementations using real production requests
CheckpointsIdentify where processing behaviour differed
FingerprintsDistinguish genuine mismatches from expected variations
Claude agentsInvestigate and fix identified differences
Human reviewVerify changes before production deployment

The company also discovered weaknesses in its initial test suite.

An audit found that more than 100 assertions had been weakened across approximately 700 migrated tests.

This was an important warning: AI-generated code and AI-assisted testing can create false confidence if the verification process itself is not sufficiently reliable.

Anthropic therefore relied on production behaviour as an additional source of evidence rather than trusting the test suite alone.

CPU Usage Falls 70% and Memory Consumption Drops Over 80%

After completing the migration, Anthropic reported significant improvements in the performance of its Messages API.

The company observed the following changes as production traffic moved from Python to Rust:

Performance metricReported improvement
CPU usage per requestApproximately 70% lower
Memory usage per requestMore than 80% lower
Median time to first tokenApproximately 20% lower
API traffic growth since early 2024Approximately 1,800 times

The reduction in CPU usage means Anthropic can process requests using substantially fewer computing resources.

Lower memory consumption can also help the company operate more efficiently as traffic increases.

The improvement in median time to first token is particularly relevant to users because it reduces the waiting time before Claude begins responding.

Anthropic reported this latency improvement for the measured Claude Code requests.

However, these figures represent infrastructure and request-processing improvements. They do not mean that Claude’s underlying AI model became 70% faster or that the total cost of operating the entire service fell by 70%.

What the Migration Means for AI Infrastructure Costs

The migration could have important economic implications for Anthropic.

Running large AI services requires substantial computing infrastructure. Every request involves not only the resources needed to generate a response but also the supporting systems responsible for validation, processing, safety checks and communication.

Reducing the CPU and memory required for these supporting operations can help companies serve more requests with their existing infrastructure.

For Anthropic, this becomes increasingly important as Claude Code, Cowork and other products generate growing demand for the Messages API.

The efficiency gains could help the company accommodate additional customers and more complex AI-agent workflows without increasing infrastructure resources at the same rate as usage.

It also demonstrates why software architecture remains important even when the most expensive part of an AI service is the computing power required to run the underlying models.

AI Coding Agents Could Change How Software Engineers Work

Anthropic’s migration provides an example of how AI coding tools are moving beyond small programming tasks.

Instead of simply generating individual functions or suggesting code changes, Claude helped complete a large-scale infrastructure migration involving thousands of interconnected behaviours.

The project also demonstrates a possible change in the responsibilities of software engineers.

Traditionally, engineers spend substantial time writing code, implementing features and fixing bugs.

With more capable AI agents, some of these tasks can increasingly be automated. Engineers may instead spend more time designing verification systems, defining requirements, reviewing changes and ensuring that software behaves correctly.

Anthropic’s experience suggests that the ability to verify AI-generated work could become one of the most important skills in software engineering.

The Bigger Picture

Anthropic’s Python-to-Rust migration demonstrates two important developments in the AI industry. First, companies are increasingly using AI models to improve the infrastructure behind their own products. Second, AI-generated code is becoming capable of supporting large production engineering projects rather than just isolated programming tasks.

The reported 70% reduction in CPU usage and more than 80% reduction in memory consumption show the potential benefits of combining AI-assisted development with efficient programming languages. However, the months of verification required for the migration also demonstrate that human oversight remains essential when AI-generated code is deployed in critical systems.

Looking Ahead

Anthropic’s experience could encourage other technology companies to reconsider how they maintain and modernise large software systems. As AI coding agents become more capable, migrations that were previously too expensive or time-consuming may become more practical, particularly when companies have reliable ways to compare old and new systems.

The next phase of software engineering may therefore involve fewer hours spent writing routine code and greater emphasis on testing, verification and system design. Anthropic’s project offers an early example of how AI can help build the infrastructure that supports future AI services.

Get the day’s top stories in your inbox

One concise email. No spam, unsubscribe anytime.