The problem: I changed one line and now I get a 400
You replace the model name in the configuration, relaunch the application and the first request comes back with
HTTP 400 and a message that talks about thinking. Or it is worse: no error, but the interface that
showed updates between one tool call and the next stays mute, and consumption may change. The code is not wrong:
it was written for another generation, and between one generation and the next some valid requests become
invalid.
The good news is that these breakages are few, every release page lists them, and they can be searched for in your code before changing the ID. The method has three steps: a static scan of the suspect requests, reading the model's capabilities from the service, and (if you have a key) a targeted request for each suspect. This article builds the first step with a script that I ran, shows the other two as schemas to adapt, and tells you what no scan can find, that is the changes that make nothing fail.
The content depends on the generations, so the model names and the verdicts sit in a single dated block, "Status as of 2026-11-12". The rest is method. To know which model you are really using, first read Which Claude Model to Use: Aliases, Pinned Versions and What Changes by Provider. The breakages of the previous generations are in the historical snapshots Opus 4.6 and Sonnet 4.6 and Opus 4.7 and 1M Context.
Three causes of breakage, which are not searched for in the same way
Before writing code it is worth separating the cases, because each has a different remedy. The first is the
rejected request: a parameter that the new model does not accept comes back as a 400 error of
type invalid_request_error, and it is the easiest case, because it fails at once and loudly. The
second is the different response: no error, but the shape or the quantity of what you receive
changes. The third is the API version, which does not depend on the model: a new version can
remove parameters from all models together, and it has already happened (see the dated block at the bottom).
The first case is found with a scan of the code or with a test request. The second is found only with tests that look at the output: neither a regex nor an HTTP code tells you that the interface has gone silent. The third is found by looking at which API version your library asks for, because the documentation explains that an SDK uses the version current at the moment its major version came out: upgrading the library can therefore change the rules without you having touched the model.
Step 1: a static scan of the suspect requests
Every "What's new" page of a model contains a list of breakages, and the Opus 5.5 migration page opens with a list of what "every request must satisfy". I turned those lines into a table of rules: a regular expression, and for each model I care about the verdict written by the documentation. When the documentation says nothing about a model, the verdict is "not stated": I prefer a declared gap to an invented "ok". The verdict is not a proof, it is the quotation of the page.
"""Search the code for requests that the documentation declares broken on a new model."""
import re
import sys
from pathlib import Path
MODELLI = ("opus-5-5", "sonnet-5-5", "haiku-5-5")
NI = "not stated"
# (name, expression, outcome per model in the order of MODELLI, source page)
REGOLE = [
("thinking disabled",
r"thinking\W{1,6}type\W{1,4}disabled", ("400", "400", "ok up to high"), "whats-new-*-5-5"),
("budget_tokens",
r"budget_tokens", ("400", "400", "400"), "whats-new-*-5-5, release notes 2026-10-07"),
("tool_choice any/tool",
r"tool_choice\W{1,6}type\W{1,4}(?:any|tool)\b", ("400", "400", NI), "whats-new-*-5-5"),
("temperature/top_p/top_k",
r"\b(?:temperature|top_p|top_k)\b\s*[:=]", ("omit", NI, "may give 400"),
"migration-guide opus-5-5, release notes 2026-10-07"),
("computer_20251124",
r"computer_20251124", ("400 (not on Bedrock)", "400 (not on Bedrock)", NI), "whats-new-*-5-5"),
("superseded beta header",
r"(?:effort-2025-11-24|fine-grained-tool-streaming-2025-05-14|interleaved-thinking-2025-05-14"
r"|output-128k-2025-02-19|token-efficient-tools-2025-02-19)", ("remove", NI, NI),
"migration-guide opus-5-5, checklist"),
]
ESTENSIONI = {".py", ".ts", ".js", ".json", ".sh", ".yml"}
def main(radice):
radice = Path(radice)
righe_trovate = []
print(f"{'file:line':28} {'rule':24} " + " | ".join(f"{m:22}" for m in MODELLI))
for file in sorted(radice.rglob("*")):
if not file.is_file() or file.suffix not in ESTENSIONI:
continue
testo = file.read_text(encoding="utf-8")
for nome, espressione, esiti, _fonte in REGOLE:
for m in re.finditer(espressione, testo):
riga = testo.count("\n", 0, m.start()) + 1
righe_trovate.append((file.relative_to(radice).as_posix(), riga, nome, esiti))
for percorso, riga, nome, esiti in sorted(righe_trovate):
print(f"{percorso + ':' + str(riga):28} {nome:24} " + " | ".join(f"{e:22}" for e in esiti))
print(f"{len(righe_trovate)} points to review")
if __name__ == "__main__":
main(sys.argv[1])
# Output:
# file:line rule opus-5-5 | sonnet-5-5 | haiku-5-5
# agent/screen.json:1 computer_20251124 400 (not on Bedrock) | 400 (not on Bedrock) | not stated
# app/extraction.py:4 temperature/top_p/top_k omit | not stated | may give 400
# app/extraction.py:5 budget_tokens 400 | 400 | 400
# app/extraction.py:6 tool_choice any/tool 400 | 400 | not stated
# app/extraction.py:9 superseded beta header remove | not stated | not stated
# app/routing.ts:4 thinking disabled 400 | 400 | ok up to high
# app/routing.ts:5 tool_choice any/tool 400 | 400 | not stated
# 7 points to review
The script does not interpret the language: it searches for text. The expression for thinking
disabled allows from one to six non-alphanumeric characters between the words, so it recognizes both the
Python dictionary and the TypeScript object, without depending on how the code is formatted. The columns report
the verdicts of the three models. The "superseded beta header" row has a verdict only for Opus 5.5, because it is
the migration guide of that model that asks to remove those headers; for Sonnet and Haiku I read nothing on the
subject.
The test project is mine: four files, one of which is clean (ok.py uses only
output_config with effort and produces no rows, as it should). The script finds seven
points in three files. In extraction.py there are four: the sampling, budget_tokens, the
forced tool_choice and the beta header; in routing.ts there are two; in
screen.json the computer_20251124 tool. The thinking disabled row shows why
a per-model matrix is needed: same payload, 400 on two models, accepted on the third.
The tool has a defect that I measured. I launched it on a Python service of the site that calls a provider other
than Anthropic: it flagged 16 points, all of the temperature rule, all false positives, because that
service never sends anything to the Messages API. A scan by text does not know to whom the request is addressed,
so every row is a point to review, never a diagnosis. It does not see two problems either: the prefill (a
conversation that ends with an assistant turn) and the edits to previous turns, because they depend on the flow
of the program and not on a line.
Step 2: read from the service what the table says in words
If you maintain a table by hand, sooner or later it will be out of date. The models API exposes the same
information in a machine-readable form: for each model a capabilities object with
thinking.types.disabled.supported, between_tools and enabled. The
reference page clarifies the meaning of disabled.supported: it is false exactly when a request that
sends it receives a 400 from that model. It is the answer to the question "will this request pass?" without
trying it, and it holds also for models released after you wrote the script.
# Schema to adapt: it needs an API key. It reads from the service what the table says in words.
curl -s "https://api.anthropic.com/v1/models?limit=1000" \
-H "anthropic-version: 2026-10-21" \
-H "Authorization: Bearer $ANTHROPIC_API_KEY" \
| jq -r '.data[]
| select(.id | test("^claude-(opus|sonnet|haiku)-5-5$"))
| [.id,
.capabilities.thinking.types.disabled.supported,
.capabilities.thinking.types.between_tools.supported,
.capabilities.thinking.types.enabled.supported] | @tsv'
No response value is reported here: I do not have a key and I did not run the command. There is also a reason not
to copy the documentation's example: the reference page shows a sample response where an active model
has a retires_at of 2019, so it must be read as a placeholder and not as data. The
select filter limits the output to the three models of the dated block, but you can remove it to see
the whole list.
Step 3: a targeted request for each suspect
The final confirmation is to try. A request with minimal max_tokens generates at most a few tokens,
and for each suspect of the scan one is enough: the test on the old model must succeed, the one on the new model
must fail with the message that the page reports. If the verdict you hold was "400" and you receive 200, either
the documentation has changed or you read it wrong, and in both cases you want to know before the release.
# Schema to adapt: it sends a real request (few tokens, but it costs) and prints only the HTTP code.
curl -s -o response.json -w "%{http_code}\n" https://api.anthropic.com/v1/messages \
-H "anthropic-version: 2026-10-21" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 16,
"thinking": {"type": "disabled"},
"messages": [{"role": "user", "content": "ok"}]
}'
jq -r '.error.type, .error.message' response.json
The block sends thinking with type disabled to claude-opus-5-5 and prints
the HTTP code and the text of the error. According to the "What's new in Claude Opus 5.5" page the expected code
is 400, with a message saying that thinking.type.disabled is not supported and pointing to
thinking.type.adaptive and to output_config.effort. It is a quotation, not an output of
mine. The key header follows the examples of the page, and the migration documentation specifies that the API
accepts the key both in x-api-key and in Authorization.
What no scan finds
The silent breakages have a list of their own in the release pages, and it is the list to turn into behavior tests. The same checks are not enough, because there is no error to look for:
- the default
effortlevel changes from one model to another, so the same request may think more or less; - the text written between two tool calls may arrive in blocks of type
thinking, empty if you do not ask to display them, and an interface that shows them stays mute; - responses may begin with a
thinkingblock, so code that takes the first element ofcontentgets it wrong: blocks are chosen by type; - a different tokenizer counts more tokens for the same text, and costs and
max_tokenslimits change; - a conversation that changes model (for a router or a fallback) may lose the reasoning of the previous turns, because not all models read the thinking blocks of the others.
None of these five items produces an HTTP code other than 200, and this is why the scan is not enough. The remedy
is a suite of cases with a known response, run on the new model, that compares shape and consumption besides the
text: for each item a simple check (is the first block of type text? are the tokens consumed of the
expected order of magnitude? does the interface still receive the updates?).
Status as of 2026-11-12: the matrix for Opus 5.5, Sonnet 5.5 and Haiku 5.5
The verdicts below report the "What's new" pages of the three models, the Opus 5.5 migration guide, the release notes of 2026-09-22, 2026-09-28 and 2026-10-07 and the guide to API 2026-10-21, accessed on 2026-11-12. The "not stated" column means that the page I read says nothing about that model.
| Request | Opus 5.5 | Sonnet 5.5 | Haiku 5.5 |
|---|---|---|---|
thinking with type disabled | 400 | 400: use between_tools (at effort up to high) | accepted at effort up to high |
thinking with budget_tokens | 400 | 400 | 400 |
tool_choice of type any or tool | 400 | 400 | not stated |
computer_20251124 tool (API and Google Cloud) | 400 | 400 | not stated (for computer_20250124 it is 400) |
| Prefill (last turn from the assistant) | rejected | not stated | 400 |
temperature, top_p, top_k | to be omitted | not stated | may give 400 |
Editing system, tools or previous turns with thinking blocks | may give 400 | listed among the breakages; detail not read | may give 400 |
| Default effort (not an error) | medium | high | medium |
Above these rows sits the API version. From 2026-10-21, according to the migration guide,
temperature, top_p and top_k produce a 400 on any model, even at the
default value; a document block in an assistant message and the citations in a user
text produce the same error. On Amazon Bedrock that version is available only for models from 4.7 onward. For the
libraries, the guide indicates Python 2.0.0 and TypeScript 1.0.0 as the first versions that use the new
version.
The "may give 400" cells are deliberately vague, because the Opus 5.5 page writes that a failed prefix check "might or might not" produce an error, and refers to a page on the prefix checks that the model applies. On Fable 5.2, instead, a failed check returns 400. If your application builds the messages by itself, the only safe behavior that the documentation indicates is to keep the conversation append-only and to send back each assistant turn exactly as it came back.
What stays true with the next generation
- Every new model has a page with the breakages compared with the previous one: you read it before changing the ID, not after the first error.
- The same payload can pass on one model and fail on its sibling: the matrix is per model, not per generation.
- A scan of the code finds the breakages that reject the request; for the silent ones you need tests that look at the response.
- Capabilities are read from the service instead of being copied into a table by hand.
If a new version comes out, the part to rewrite is the table of the dated block and the constants of
compat.py. The method does not change: open the page of the new model, turn its breakages into
rules, launch the scan on your code, check the capabilities from the service and try one request per suspect.
What I did not verify
I did not send any request to a model: all the "400s" of this article are quotations of the documentation, not
outcomes that I saw. I did not read the migration guides of Sonnet 5.5 and Haiku 5.5, only the "What's new" pages
and the release notes, and for Fable 5.2 only the part on prefix checks. I do not know how many real projects have
the lines that the script searches for: the only measure is that of the site's service, 16 points all false. The
expression for thinking disabled is designed for Python, TypeScript and JSON; I did not try other
languages.
What you can do now
You can tell a breakage that rejects the request from a silent one and from the API version, and you can search for the first in your code before changing the model. You can read a model's capabilities from the service, you can test a suspect with a request of a few tokens, and you know what the check does not see. And you know that the answer to the question "what changes if I move to Opus 5.5?" sits in a release page that you can consult today, instead of in an error in production.
In this series. Previous article: What a Claude Session Costs: Measure It Before the Invoice. Next article: Letting Claude Code Work Alone: /goal, Auto Mode, Background Sessions and Their Limits.
Sources
- Claude Docs: What's new in Claude Opus 5.5 - breakages compared with Opus 5, error messages, prefix check, default effort, accessed 2026-11-12
- Claude Docs: Claude Opus 5.5 migration guide - requirements of every request, checklist by starting model, beta headers to remove, accessed 2026-11-12
- Claude Docs: What's new in Claude Sonnet 5.5 -
between_toolsinstead ofdisabled, forcedtool_choice, computer tools, accessed 2026-11-12 - Claude Docs: What's new in Claude Haiku 5.5 - table of breakages compared with Haiku 4.5, tokenizer, accessed 2026-11-12
- Claude Docs: Migrating to API version 2026-10-21 - sampling parameters removed, blocks no longer accepted, library versions, accessed 2026-11-12
- Claude API Reference: List models -
capabilitiesobject and meaning ofsupported, accessed 2026-11-12 - Claude Docs: Release notes - breakages declared at the launch of Opus 5.5, Sonnet 5.5 and Haiku 5.5, accessed 2026-11-12
- Claude Docs: What's new in Claude Fable 5.2 - prefix check that always returns 400, accessed 2026-11-12
The compat.py script was run with Python 3 on 2026-11-12 (English version) on the test project and on the site's service; the blocks that call the models API or the messages API require a key and were not run.
Commenti
Caricamento commenti...
Sign in to comment