Anthropic moved its Messages API, the /v1/messages endpoint behind every Claude API call, from Python to Rust. The Anthropic Messages API Rust service has handled public traffic since September 2026. Anthropic reports about 70% less CPU per request and a roughly 20% drop in median time to first token. Your request and response format did not change.
Below: what Anthropic measured, how it proved the new service matches the old one, what to re-test, and how to measure time to first token (TTFT) yourself.
What happened: the Messages API now runs on Rust
The Messages API is the service that turns your HTTP request into a prompt, runs it through Claude and streams the answer back. Anthropic built it in Python in 2023. On November 25, 2026, Anthropic’s engineering team published Migrating our Messages API to Rust, describing a full rewrite that took public traffic in September 2026.
Three numbers from the post are worth knowing, along with their scope, which Anthropic states in a figure caption:
| Metric | Reported change | Scope Anthropic gives |
|---|---|---|
| CPU per request | about 70% lower | one region, August to October |
| Memory per request | more than 80% lower | all of production, August to October |
| Median time to first token | about 20% lower | customers’ Claude Code requests, roughly September 7 to 21 |
The TTFT number comes from Claude Code traffic, not every API customer, so your own change could be larger, smaller or invisible. The CPU and memory savings belong to Anthropic’s servers.
Why bother? Anthropic says API traffic grew roughly 1,800 times from early 2024 to fall 2026, and Python added overhead at every step. A partial rewrite of output parsing alone cut CPU by only about 8% to 10%.
What the Messages API does on every request
Per Anthropic’s post, every request passes through these stages:
- Validate the request and accept or reject it.
- Build the prompt from your system prompt, messages and tool definitions, resolving settings along the way.
- Tokenize the prompt.
- Screen it with safety classifiers.
- Run the model, which writes the reply one token at a time.
- Parse the output into text, thinking and tool calls.
- Stream the events to you and count usage for rate limits and billing.

Everything except the model moved to Rust. Steps 1, 2, 6 and 7 are where your integration touches the API: validation errors, tool definitions, returned tool calls and usage numbers.
How Anthropic verified the Rust rewrite
The interesting part isn’t Rust. It’s the verification. The Rust version passed about 98% of Anthropic’s roughly 700 integration tests by April, yet only about a quarter of production inputs matched. Tests alone weren’t enough.
So the team ran Rust as a shadow next to the live Python service. The model ran once and its output was replayed to Rust, so nondeterminism couldn’t fake a difference. Each step was compared, and the first divergence showed roughly where the bug lived.

Two details stand out:
- Privacy by design. Engineers didn’t read user requests or Claude’s replies. A diff record held only its shape: the step, the first differing byte and the lengths.
- Agents did the triage. A coordinating Claude agent handed each new kind of difference to a worker agent, which reproduced it in a sandbox, fixed the Rust code and added a test. Engineers reviewed the fixes.
The production match rate went from 24% at the start to 99.6% by August, according to the post’s chart. Public traffic moved in September.
What changed for Claude API users, and what didn’t
Here’s the practical split.
| Area | Changed? | What to do |
|---|---|---|
| Endpoint, headers, request body | No change announced | Nothing |
| Response and streaming event shapes | No change announced | Keep your contract tests running |
| Model behavior | No (same models) | Nothing |
| Median TTFT | Lower on Claude Code traffic | Measure your own |
| Edge cases in prompt building and output parsing | Built to match Python exactly | Re-run tests on tools, usage and limits |
The post doesn’t announce any change to the public contract. The goal was parity with the Python service, “so that we could pin down any deviation that might change what a customer received.” Your integration has likely run on Rust since September already.
The bugs Anthropic found along the way still make a useful checklist:
- JSON escaping in tool calls. Python escaped certain characters, such as emoji, into text codes; the first Rust version wrote them as-is. Both are valid JSON. If you hash, cache or byte-compare raw tool-call strings, parse them first.
- A context limit read as the wrong size. One diff showed a 1M limit read as 200K. Test a long prompt against the limit you expect.
- Missing tool descriptions and stripped newlines. A prompt that loses part of itself still returns a 200 and a plausible answer, which is why these bugs are quiet. Assert on output quality for your tool-heavy prompts, not only on status codes.
- Missing usage fields. Your billing dashboards read
usage. Assert thatinput_tokensandoutput_tokensare always present.
None of these are known open issues today. They’re the categories worth a contract test, especially if you also pin a newer API version; our guide to Claude API version 2026-10-21 covers that upgrade separately.
How to measure time to first token on your own calls
Time to first token is the delay between sending a request and receiving the first piece of generated text. On a streaming call, that’s the first content_block_delta event, not the HTTP 200 or message_start, which arrive before the model has written anything. The streaming docs list the full event order.

- Save this as
ttft.mjs(Node 18 or later):
const t0 = performance.now();
const res = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"x-api-key": process.env.ANTHROPIC_API_KEY,
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
body: JSON.stringify({
model: "claude-haiku-5-5",
max_tokens: 64,
stream: true,
messages: [{ role: "user", content: "Name three rivers in five words." }],
}),
});
const requestId = res.headers.get("request-id");
const decoder = new TextDecoder();
let ttft = null;
for await (const chunk of res.body) {
const text = decoder.decode(chunk, { stream: true });
if (ttft === null && text.includes("event: content_block_delta")) {
ttft = performance.now() - t0;
}
}
const total = performance.now() - t0;
console.log(JSON.stringify({ requestId, status: res.status,
ttftMs: Math.round(ttft), totalMs: Math.round(total) }));
- Run it 20 times or more; one sample is mostly network jitter.
- Report the median and p95. Anthropic’s claim is about the median.
- Keep prompt, model and
max_tokensfixed, and log therequest-idfor support (see the errors reference). - Count 429 and 529 responses separately: they’re rate limiting and overload, not latency. See our guide to Claude API rate limits.
Let your coding agent run the check with Apidog CLI
A latency script tells you how fast the API is; a contract test tells you it still returns what your code expects. Apidog CLI lets Claude Code, Codex or another coding agent create the test in your Apidog project and run it.
Set it up once:
npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com # pick your agent when prompted
Then give your agent one prompt:
In Apidog project <projectId>, add an environment whose base URL is
https://api.anthropic.com and that reads my key from ANTHROPIC_API_KEY. Create the
endpoint POST /v1/messages and a test case that sends a short non-streaming request
to claude-haiku-5-5 with max_tokens 64 and asserts: status 200, a request-id header,
content[0].type is text, stop_reason is end_turn or max_tokens, and
usage.input_tokens and usage.output_tokens are integers. Run it 20 times, list
failures with their request-id, then run ttft.mjs 20 times and report median and p95.
The agent checks existing environments, reads payload shapes instead of guessing, then writes and runs the case:

apidog environment list --project <projectId>
apidog environment create "Claude API" --project <projectId> --base-url https://api.anthropic.com
apidog cli-schema get endpoint-create
apidog endpoint create --project <projectId> --file messages-endpoint.json
apidog cli-schema get test-case-create
apidog cli-schema validate test-case-create --file messages-contract.json
apidog test-case create --project <projectId> --file messages-contract.json
apidog run --test-case <caseId> --project <projectId> -e <envId> -n 20 -r cli,json
-n 20 repeats the case and -r cli,json writes a report the agent reads back to you. Put the same apidog run ... -r junit step in CI and a quiet change in the response shape fails your build instead of your billing dashboard; the Apidog CLI CI/CD pipeline guide has a copy-paste setup. New to the CLI? Start with how to use the Apidog CLI in Claude Code.
If your team calls the Claude API from several services, Sharkly lets you hand each one’s contract check to a coding agent as a task on a shared board, with the agents running on your own machines under your existing Claude Code or Codex plan, and review what they ship before it merges. It’s free to start.
Conclusion
The Anthropic Messages API Rust migration is a server-side change you were never asked to act on, and that’s the point: Anthropic spent months proving the new service matched the old one on real traffic.
Still, “same contract” is a claim you can check in an afternoon. Measure your own TTFT, keep a contract test on tool calls, usage fields and limits, and let your coding agent run both on a schedule.
FAQ
Did Anthropic change the Claude API when it moved to Rust? No change to the request or response format was announced. Anthropic’s goal was exact parity with the Python service, verified step by step against production traffic before the cutover in September 2026.
Is the Claude API faster now? Anthropic reports a roughly 20% drop in median time to first token, measured on customers’ Claude Code requests between about September 7 and 21. Your own calls may differ, so measure them with a streaming script.
Will the Rust migration lower my Claude API bill? Anthropic doesn’t say so. The 70% CPU and 80% memory savings are on Anthropic’s servers; pricing is per token and wasn’t part of the post.
How did Anthropic test the rewrite without reading user data? It recorded only the shape of each difference (the step, the first differing byte and the lengths), never the text of requests or replies, and replayed one model output to both services.
What should I re-test after the migration? Tool calls, usage fields, long prompts near the context limit and streaming event handling. Those are the areas where Anthropic’s own diffs showed up during the rewrite.



