SalpXXAPI News
AI News 4 min read

Anthropic moved the Messages API to Rust: gateway users should watch verification, not just speed

Anthropic's postmortem reports about 70% lower CPU per request and about 20% lower median time to first token after moving the Messages API from Python to Rust. For gateway users, the reusable lesson is production shadowing, difference fingerprints, and preventing duplicate billing or quota use.

The conclusion first

On November 25, 2026, Anthropic described moving the Messages API that serves Claude, Claude Code, and Cowork from Python to Rust. The company reports about 70% lower CPU use per request and about 20% lower median time to first token for customer requests, while moving production traffic without taking the service offline or freezing feature work.1

This is not a promise that replacing a language automatically makes every gateway faster. The most useful part for API gateway operators is how Anthropic established behavioral parity: it used the production system as the reference, shadowed production traffic, ran the model once and replayed the output, located differences at checkpoints, and grouped difference fingerprints before dispatching fixes. The performance figures are Anthropic's own report; the verification method is the more portable engineering lesson.

What changed

The Messages API is a primary route through which customers and Anthropic applications reach Claude. As traffic and features expanded, a request involved validation, settings resolution, prompt construction, tokenization, safety classifiers, streamed output assembly, tool calls, and usage accounting. Python added recurring overhead around object creation, memory release, and task handoffs, so Anthropic moved from a local parser rewrite to a broader migration.

The first attempt rewrote only model-output parsing in Rust. It reduced API CPU use by about 8% to 10%, but every response token still crossed the Python/Rust boundary three times. Boundary overhead and added complexity reduced the value of the incremental design. The lesson for gateway teams is to measure data movement and coordination costs, not only the benchmark of one function.

Anthropic reports these headline results:

  • About 70% lower CPU use per request.
  • About 20% lower median time to first token for Claude Code customer requests.
  • Public traffic moved to Rust in September 2026.
  • The service stayed online and feature work continued during the migration.1

These are measurements published by the provider from its own production charts, not an independent benchmark. A gateway should not turn them into its own latency, price, or success-rate guarantee without measuring its own path.

Why passing tests was not enough

Anthropic started with roughly 700 integration tests, but the tests were tightly coupled to the Python implementation: they ran the old API in process and mocked billing and rate-limiting dependencies in Python memory. When code and tests change together, a passing test can mean that assertions became weaker. Anthropic's audit found more than 100 weakened assertions in the ported tests. At one point the Rust version passed about 98% of the tests, yet only about a quarter of production inputs matched the Python version exactly.1

The same problem appears in gateway migrations. A rewritten adapter, SSE transformer, router, or usage counter may handle ordinary JSON while missing streamed termination events, tool calls, empty fields, legacy parameters, or failure retries. An HTTP 200 response also cannot prove that a field was not dropped, a charge was not duplicated, or context was not truncated.

A reusable shadow-verification pattern

Anthropic's approach can be reduced to a gateway-friendly sequence:

  1. Define an independent comparison target. Record expected behavior for status codes, response structure, error classes, usage fields, and billing events before changing the implementation.
  1. Copy traffic without duplicating side effects. A shadow request must not charge a customer twice, invoke a write-capable tool twice, or count as two rate-limit events. Isolate model output and external side effects.
  1. Add checkpoints by stage. Compare authentication, parameter parsing, model selection, prompt construction, upstream parsing, stream events, and final usage instead of comparing only the final text.
  1. Record difference fingerprints. Capture the stage, field, offset, and size of a difference. Do not default to storing prompts, uploaded files, or complete model replies. Group identical fingerprints so one bug does not create many duplicate fixes.
  1. Replay production-shaped samples after a fix. Test in isolation, require human review, and continue shadowing until the difference disappears.

Claude replies are nondeterministic, so Anthropic ran the model once and replayed the same output through the old and new paths. Gateway migrations should likewise separate model randomness from adapter behavior; otherwise normal variability can look like a regression.1

What SalpX users should ask

When a gateway announces a new upstream SDK, router, or protocol adapter, do not ask only how much faster it is. Ask whether the operator can answer these questions:

  • Are model names, request fields, and response formats still compatible?
  • Were streaming events, tool calls, thinking or reasoning fields tested individually?
  • Can shadow traffic duplicate quota deductions, tool side effects, or success-rate counts?
  • Can an error and its request_id be tied to one real request?
  • Can usage and billing be sampled before and after the migration?

SalpX documents https://www.salpx.com/v1 as its Base URL, Bearer authentication through Authorization: Bearer <API Key>, and GET /v1/models for models visible to the current token.2 These checks establish basic access and model visibility; they do not prove that every advanced protocol field is forwarded. Start with a fixed set of non-sensitive requests and record status, response shape, usage, and request ID before increasing traffic.

Remember

The visible subject of Anthropic's announcement is a Python-to-Rust rewrite. The deeper subject is how to prove that a production rewrite did not change behavior in unsafe ways. Gateway users should look for an independent comparison target, production verification, difference localization, one-time billing protection, and rollback. Performance matters, but reproducible behavioral parity is what makes a gateway migration safe to ship.

Sources & attribution

This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.

  1. Migrating our Messages API to Rust — Anthropic · accessed 2026-11-28Note:Anthropic's official engineering article, published November 25, 2026, reports about 70% lower CPU per request and about 20% lower median time to first token after migrating Messages API from Python to Rust, and explains its production-traffic shadow verification method.
  2. SalpX API Reference — SalpX · accessed 2026-11-28Note:SalpX's official documentation provides the Base URL, Bearer authentication, and model-list endpoint used in the gateway-side checks recommended here.

One key for Claude, GPT and 50+ models

The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.