Anthropic Engineering·
Migrating our Messages API to Rust
TL;DR
Rapid traffic growth made Anthropic’s Python Messages API too costly to run, but moving it to Rust required preserving production behavior that tests alone missed. The team used Claude to help rewrite the service and checked it against live Python traffic, replaying the same model output and recording differences without reading customer content. The migration reduced CPU use per request by about 70% and median time to first token by about 20%, without downtime or pausing feature development.
Relevant links
- Engineeringwww.anthropic.com
- Codingwww.anthropic.com
- Claude Developer Platformwww.anthropic.com
- Agentswww.anthropic.com
- Compute & energywww.anthropic.com
- Effective harnesses for long-running agentswww.anthropic.com
- proofsalpo.ge
- migratingbun.com
- fall outside the test suitegithub.blog
- a definition of “correct” that covers everythingwww.anthropic.com
- Messages APIplatform.claude.com
- more than 80% of the code Anthropic mergedwww.anthropic.com