{
  "id": 21824511,
  "title": "Anthropic details migrating its Messages API, the primary way customers access Claude, from Python to Rust, and using the Python service to verify the migration (Anthropic)",
  "url": "https://urgent.news/2026/11/25/anthropic-details-migrating-its-messages-api-the-primary-way",
  "topic": "ai",
  "section": "AI",
  "published": "2026-11-25T17:05:04.000Z",
  "source": {
    "name": "Techmeme",
    "slug": "techmeme",
    "url": "https://www.anthropic.com/research/migrating-api-to-rust"
  },
  "original_language": "en",
  "account": "Many problems require a generator-verifier gap, where verifying a solution is easier than creating it. Sudoku exemplifies this. Verifying a solution is straightforward, but finding one can be time-consuming. Ambitious Claude projects often depend on this gap, such as formalizing mathematical proofs or migrating large codebases with reliable verification. As Claude's capabilities grew, it started tackling live systems, where generating work is simpler than verifying it. Users often rely on edge cases and quirks outside test suites, making trust in the migration crucial. Anthropic faced this challenge when migrating its Messages API from Python to Rust. This API is central for customers and Anthropic's apps, experiencing significant traffic growth from 2024 to 2026. Rust would reduce CPU usage per request by a large margin. Writing Claude's core request path in Rust took about a week, but verifying the migration's parity with the production API proved difficult. The Python API kept changing, making parity a moving target. Claude's nondeterministic replies and lack of access to customer requests further complicated the process. The solution was to turn the production Messages API into a verifier. By using the existing system as an oracle during migration, Anthropic could test the new Rust version on production traffic, identify differences, and automatically fix them. This enabled a 70% reduction in CPU per request and a 20% decrease in median time to first token without service downtime or feature freeze. The Messages API was initially developed in Python for internal research purposes. Over time, it became deeply integrated with Python libraries, making a language change challenging. By late 2025, every API request required validation, conversion into prompts, tokenization, safety checks, and sorting of tokens. Python added significant overhead to these steps. Anthropic decided to rewrite the code that parses the model's output in Rust, reducing CPU usage by 8% to 10%. However, incremental improvements came with added complexity. By May 2026, Claude was responsible for over 80% of the code in the migration project. The challenge was defining \"correct\" for the migration, as the Python API's changes created a moving target. Verification became the bottleneck.",
  "summary": "Sudoku is a classic example. It's simple to check the solution (just count the numbers in each row, column, and box), but finding that solution can take a long time.",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}