The problem: the same name, a different model
You wrote opus in the configuration file, the pipeline has been running for weeks, and one day the
cost per run changes, or the answer has a different tone. Nobody touched the repository. Or it works on your
laptop and the CI job, on another provider, answers with an older model. In both cases the cause is the same:
you wrote an alias, that is a name that somebody else resolves into a model, and the resolution
depends on the Claude Code version and on the provider.
The rule that survives a change of generation is simple. For interactive use, where you always want the most recent model, the alias is perfectly fine. For everything that has to be repeatable (CI, nightly scripts, subagents, a comparison between two versions of a prompt) you write the model's full ID, which from generation 4.6 onward is a fixed snapshot. And every now and then you check which of your IDs are on their way to retirement, instead of finding out from an error.
This article continues the series after the snapshot of generation 4.5 in Generation 4.5: Sonnet, Haiku and Opus 4.5 Compared. Model names age in a few weeks, so they all sit in one place: the dated block "Status as of 2026-11-12". Everything else is method, and it still holds when the names change. For installation and the basic commands see Claude Code CLI: Essential Commands and Configuration; for the general picture of Claude as a technical partner, Claude: Foundation and Technical Partner.
Aliases and IDs: three things with almost the same name
The documentation uses the word "alias" for three different objects, and mixing them up is the origin of most
misunderstandings. The first is the Claude Code alias: opus, sonnet,
haiku, fable, best, opusplan. The CLI translates them into a
model and, according to the configuration page, they point to the recommended version for your provider and are
updated over time. The second is the API alias for the models before 4.6, such as
claude-sonnet-4-5: it is a convenient pointer to the most recent dated snapshot of that minor
version. The third is not an alias, even though it looks like one: the undated ID of the models from 4.6 onward,
such as claude-opus-5-5, is the snapshot itself.
| How it is written | What it is | Does it change by itself? |
|---|---|---|
opus, sonnet, haiku, fable | Claude Code alias | Yes: with the CLI version and with the provider |
claude-sonnet-4-5 (undated) | API alias, only for the models before 4.6 | Yes: it follows the most recent snapshot of that minor version |
claude-sonnet-4-5-20250929 (dated) | ID of a snapshot | No, but it has a retirement date |
claude-opus-5-5 (undated, from 4.6 onward) | ID of a snapshot | No: an updated model comes out with a new ID |
The difference that matters is in the last column. The "Model IDs and versioning" page is explicit: Anthropic does not update the weights or the configuration of an existing ID, and it calls the idea that an undated ID follows the latest version a common misunderstanding. There is, however, an honest limit, written on the same page: the weights are fixed, but the infrastructure around them (request routing, safety classifiers, sampling) can change, and sometimes produces small differences in behavior for the same ID. Pinning the ID gives you a repeatable model, not bit-for-bit identical answers.
An alias is a pointer that moves: how often?
To understand how much "updated over time" means, it is worth measuring it, and the documentation allows it: at
the bottom of the configuration page there is a table with the Claude Code version in which each alias changed
model. The script below reads it from the file you downloaded, collects the rows of the form
"opus resolves to ..." and counts how many times each alias appears. I chose not to write the
numbers by hand because the table changes with every generation: this way the count can be redone with one
command.
"""How many times a Claude Code alias changed model, according to the official table."""
import re
import sys
from collections import defaultdict
testo = open(sys.argv[1], encoding="utf-8").read()
sezione = testo.split("## Version history", 1)[1]
cambi = defaultdict(list)
for riga in sezione.splitlines():
m = re.match(r"\|\s*(v[\d.]+)\s*\|\s*`(\w+)`\s+resolves to (.+?)\s*\|\s*$", riga)
if m:
versione, alias, destinazione = m.groups()
cambi[alias].append((versione, destinazione))
for alias, righe in sorted(cambi.items()):
versioni = ", ".join(v for v, _ in righe)
print(f"{alias:7} {len(righe)} rows: {versioni}")
# Output:
# best 1 rows: v2.1.321
# fable 2 rows: v2.1.321, v2.1.257
# haiku 1 rows: v2.1.293
# opus 4 rows: v2.1.280, v2.1.219, v2.1.207, v2.1.154
# sonnet 2 rows: v2.1.284, v2.1.197
In today's table the opus alias appears four times, in versions 2.1.154, 2.1.207, 2.1.219 and
2.1.280, and fable twice. One of those rows (2.1.207) concerns only the providers other than the
direct API, so on the Anthropic API the changes of opus are three. The count does not say how many
days pass between one change and the next, because the table has no dates: it only says that "being updated" is
not a rare event. On my machine claude doctor reports automatic updates enabled on the
latest channel, with the last update to 2.1.322 on 2026-11-10: if your CI too installs the most
recent CLI on every run, your alias moves without any commit recording it.
Pinning the model: where to write it and who wins
Claude Code reads the model from five places, and the order is the surprising part. What you choose during the
session with /model wins; then the --model flag at startup; then the
ANTHROPIC_MODEL environment variable; then the model field of the settings files; last
the ANTHROPIC_DEFAULT_MODEL variable, which applies only if none of the others is present. The
settings page contributes a detail that hurts in CI: an ANTHROPIC_MODEL exported in the shell beats
the model field of any file, so the model pinned in the repository can be silently overridden by a
runner variable.
To pin the versions without touching every command, a project settings file is enough. The block below writes the
full ID as the starting model and uses the ANTHROPIC_DEFAULT_*_MODEL variables, which the
documentation indicates as the way to make the aliases point to a precise version: this way sonnet
and haiku, used inside subagents or commands, do not move when a new model comes out. In project
files the env variables apply, for the most part, after the folder has been approved. The file is
valid JSON (I passed it to python3 -m json.tool, exit 0); I did not load it in a session.
{
"model": "claude-opus-5-5",
"env": {
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
}
}
The choice has a price and it must be said: with pinned IDs you no longer automatically receive the best model, and sooner or later that ID will have a retirement date. The gain is that a model change becomes a one-line edit, visible in the diff and tried before it reaches users. A second price sits in third-party providers: there the documentation asks you to pin the versions already in the initial configuration, because the alias may point to a version that your account has not enabled yet, and on Foundry this produces errors instead of a warning.
In the step from name to model the CLI does not protect you from typos. To check it I launched
claude with wrong values and a subcommand (auth status) that starts no conversation: it
only makes the CLI read the flags. The block shows the real output of this machine.
# auth status starts no conversation: it only makes the CLI read the flags
for flag in "--model opuss" "--model claude-opus-5-5" "--effort turbo" "--effort xhigh"; do
claude $flag auth status >/dev/null 2>errore.txt
echo "$flag -> exit $? | $(head -c 160 errore.txt)"
done
# Output:
# --model opuss -> exit 0 |
# --model claude-opus-5-5 -> exit 0 |
# --effort turbo -> exit 0 | Warning: Unknown --effort value 'turbo' — ignoring it and using the default effort. Valid values: low, medium, high, xhigh, max.
# --effort xhigh -> exit 0 |
--model opuss exits with code 0 and without a message: the CLI does not reject the value at
startup, and the documentation confirms that the error appears at the first request ("There's an issue with the
selected model"). An unknown --effort value, instead, produces at least a warning and is ignored. In
a nightly script a typo in the model fails late, inside the first call; this is why it is worth passing the name
through a single variable and checking it with the audit script you will find further on.
Which model really answered
Before looking for the culprit of a change in behavior you have to know which model was there. Three facts from
the documentation help. A session resumed with --resume or --continue keeps the model
it was saved with, unless you indicate a new one. If the requested model has a scheduled retirement or is
remapped, since 2.1.182 a warning goes to standard error even in non-interactive mode; that warning is
suppressed with --output-format json, and in that case the effective model is read from the
modelUsage field of the result message.
# Schema to adapt: claude -p really sends a request, so it needs an account and it costs.
claude --model sonnet -p "Reply only: ok" --output-format json | jq '.modelUsage'
I did not run this command: claude -p sends a request to a model and requires an account with
credit. This is why I show you only the line that the documentation describes, without reporting an answer. I do
not know the exact shape of modelUsage: print it whole the first time and then choose the field to
filter.
Checking retirements before they arrive
Every ID has its own calendar, even the versions of the same model. The deprecations page distinguishes four states (active, legacy, deprecated, retired), promises at least 60 days of notice for the models released to the public, and warns that requests to a retired model fail. The notice is a promise made by email and in the documentation: if the mail lands on a person who has left the project, the first news will be an error in production. Better a check that runs on your own code.
The script that follows searches the project files for claude-* IDs, the values of
--model and the "model" field of the settings, and compares them with the "Model
status" table of the deprecations page. To reproduce the example I built a test project of seven files, written
by me, containing an ID on its way to retirement, one already retired, an API alias, a typo and a Claude Code
alias. The date is a parameter (--today) to make the output repeatable: without it, the script uses
the date of the day.
"""Search the code for Claude model names and compare them with the retirement table."""
import argparse
import re
import sys
from datetime import date, datetime
from pathlib import Path
ALIAS_CLAUDE_CODE = {"opus", "sonnet", "haiku", "fable", "best", "opusplan"}
ID_MODELLO = re.compile(r"claude-(?:opus|sonnet|haiku|fable)-\d+(?:-\d+)?(?:-\d{8})?")
ALIAS_FLAG = re.compile(r"--model[ =]([\w.\[\]-]+)")
ALIAS_JSON = re.compile(r'"model"\s*:\s*"([\w.\[\]-]+)"')
ESTENSIONI = {".py", ".ts", ".js", ".json", ".yml", ".yaml", ".sh", ".env"}
def leggi_tabella(percorso):
"""Rows `| name | status | deprecated | retirement |` of the Model status section."""
sezione = Path(percorso).read_text(encoding="utf-8").split("## Model status", 1)[1]
sezione = sezione.split("## Deprecation history", 1)[0]
tabella = {}
for riga in sezione.splitlines():
celle = [c.strip() for c in riga.strip().strip("|").split("|")]
if len(celle) == 4 and celle[0].startswith("claude-"):
tabella[celle[0]] = (celle[1], celle[3])
return tabella
def parse_data(testo):
"""'November 30, 2026' -> date; the 'Not sooner than' prefix is removed first."""
return datetime.strptime(testo, "%B %d, %Y").date()
def descrivi(stato, ritiro, oggi):
soglia = ritiro.startswith("Not sooner than")
giorno = parse_data(ritiro.replace("Not sooner than ", ""))
giorni = (giorno - oggi).days
if stato == "Retired":
return f"{stato} on {giorno} ({-giorni} days ago)"
if soglia and giorni < 0:
return f"{stato}, earliest retirement date ({giorno}) passed {-giorni} days ago"
prefisso = "retirement not before" if soglia else "retires on"
return f"{stato}, {prefisso} {giorno} (in {giorni} days)"
def giudica(nome, tabella, oggi):
if nome in ALIAS_CLAUDE_CODE or nome.split("[")[0] in ALIAS_CLAUDE_CODE:
return "Claude Code alias: points to a model that changes with the CLI version"
if nome in tabella:
return descrivi(*tabella[nome], oggi)
datati = sorted(k for k in tabella if k.startswith(nome + "-") and re.search(r"\d{8}$", k))
if datati:
return f"ALIAS of the latest snapshot: today {datati[-1]}, tomorrow unknown"
return "not in the table: a typo, or a model I do not know"
def main():
p = argparse.ArgumentParser()
p.add_argument("tabella")
p.add_argument("progetto")
p.add_argument("--today", default=date.today().isoformat())
args = p.parse_args()
oggi = date.fromisoformat(args.today)
tabella = leggi_tabella(args.tabella)
radice = Path(args.progetto)
for file in sorted(radice.rglob("*")):
if not file.is_file() or file.suffix not in ESTENSIONI:
continue
for n, riga in enumerate(file.read_text(encoding="utf-8").splitlines(), 1):
trovati = ID_MODELLO.findall(riga) + ALIAS_FLAG.findall(riga) + ALIAS_JSON.findall(riga)
for nome in dict.fromkeys(trovati):
print(f"{file.relative_to(radice)}:{n} {nome} -> {giudica(nome, tabella, oggi)}")
if __name__ == "__main__":
sys.exit(main())
# Output:
# .claude/settings.json:2 opus -> Claude Code alias: points to a model that changes with the CLI version
# .claude/settings.json:3 claude-sonnet-4-6 -> Active, retirement not before 2027-02-17 (in 97 days)
# app/chat.py:1 claude-sonnet-4-5-20250929 -> Deprecated, retires on 2026-11-30 (in 18 days)
# app/classifier.ts:1 claude-haiku-4-5-20251001 -> Active, earliest retirement date (2026-10-15) passed 28 days ago
# app/summaries.py:1 claude-sonnet-4-5 -> ALIAS of the latest snapshot: today claude-sonnet-4-5-20250929, tomorrow unknown
# ci/review.yml:2 claude-opus-5-5 -> Active, retirement not before 2027-09-22 (in 314 days)
# legacy/review.py:1 claude-opus-4-1-20250805 -> Retired on 2026-08-05 (99 days ago)
# scripts/nightly.sh:1 opuss -> not in the table: a typo, or a model I do not know
The eight lines of the output read from the most urgent. claude-opus-4-1-20250805 has been retired
since 2026-08-05: that code fails today. claude-sonnet-4-5-20250929 is deprecated and will be
retired on 2026-11-30, in 18 days, and the page indicates claude-sonnet-5-5 as the replacement. The
Haiku 4.5 case is subtle: "Not sooner than" is a minimum date, passed 28 days ago, and the model stays active;
the retirement can arrive whenever it wants, with the promised notice. The undated name
claude-sonnet-4-5 today points to the deprecated snapshot, and opuss does not exist.
The script cannot judge the opus alias in the settings file, and it says so.
If you have an API key you can ask the service for the same data, which exposes for every model
lifecycle (active, deprecated, retired) and retires_at. The block below is a schema to
adapt, not run: I verified only that the jq filter compiles. The value limit=1000 is
there because the reference page indicates 20 items per page as the default.
# Schema to adapt: it needs an API key. `limit=1000` because the default is 20 models per page.
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[] | [.id, .lifecycle, (.retires_at // "-"), .line] | @tsv'
Status as of 2026-11-12: models, IDs and prices
This is the only point of the article that is rewritten with every generation. The values come from the "Models overview" page and from the "Model status" table, accessed on 2026-11-12; prices are in dollars per million tokens and must be reread on the pricing page before you use them in a quote.
| Model | API ID | Input / output | Default effort | Retirement |
|---|---|---|---|---|
| Fable 5.2 | claude-fable-5-2 | 8 / 40 | high | not before 2027-11-09 |
| Opus 5.5 | claude-opus-5-5 | 4 / 20 | medium | not before 2027-09-22 |
| Sonnet 5.5 | claude-sonnet-5-5 | 2 / 10 | high | not before 2027-09-28 |
| Haiku 5.5 | claude-haiku-5-5 | from 0,10 / from 0,50 | medium | not before 2027-10-07 |
All four have 1M tokens of context and 128K of output. Haiku 5.5 costs more per token beyond 100K of prompt,
which is why the page writes "from". The Claude Code aliases, instead, depend on the provider. On the Anthropic
API opus, sonnet and haiku point to Opus 5.5, Sonnet 5.5 and Haiku 5.5. On
Claude Platform on AWS they point to Opus 5.5, Sonnet 4.6 and Haiku 4.5; on Amazon Bedrock and on Google Cloud
Agent Platform to Opus 5.5, Sonnet 4.5 and Haiku 4.5; on Microsoft Foundry to Opus 4.6, Sonnet 4.5 and Haiku
4.5. Sonnet 5.5 requires Claude Code 2.1.284 or later, Opus 5.5 requires 2.1.280, Haiku 5.5 requires 2.1.293, and
fable points to Fable 5.2 from 2.1.321.
Read the Sonnet row on Bedrock: the same command claude --model sonnet uses Sonnet 5.5 on the direct
API and Sonnet 4.5 on Bedrock, and Sonnet 4.5 is precisely the deprecated model of the previous paragraph. It is
the concrete example of the opening problem, and the reason why in CI you write the ID.
What stays true with the next generation
- An alias serves whoever works interactively and wants the most recent model; it does not belong in processes that must give the same result twice.
- From 4.6 onward the undated ID is a snapshot: to change model you change the ID, and the change stays in the diff.
- The list of models is read from the source (the retirement table or the API), not copied into a project file.
- Retirements have a date and a notice, but the notice reaches a person: a check on your own code is more reliable than an email.
If tomorrow a model came out with a name that does not exist today, the only thing to update would be the dated block above. The rest, that is the difference between pointer and snapshot, the order in which the CLI chooses the model and the periodic check of retirements, would keep describing the behavior. To know whether a change of generation breaks your requests, the next step is the compatibility matrix that you find in another article of the series, on how to change generation without surprises.
What I did not verify
I did not call any model: no claude -p, no API keys. So I did not see with my own eyes the
retirement warning on standard error, the content of modelUsage or the answer of
/v1/models; I describe them as the documentation reports them. I did not try the aliases on Bedrock,
Foundry or the other providers: the table is the official one. I did not read the Anthropic blog guide on the
choice of model and effort that the configuration page cites. The release dates of the models are not needed by
this article and I do not report them.
What you can do now
You can tell the three meanings of "alias" apart and say which model a command will use, depending on flags, variables and files. You can pin the IDs in the project and you know why a runner variable can override them. You can read the retirement table against your code with a script you can launch every month, and you know where to look for the effective model when an answer surprises you.
In this series. Previous article: EU AI Act, MCP Security and Italian Compliance for Claude. Next article: Claude Effort and Adaptive Thinking: Measure the Right Level Instead of Guessing It.
Sources
- Claude Docs: Models overview - IDs, prices, default effort, context and retirement of the current models, accessed 2026-11-12
- Claude Docs: Model IDs and versioning - undated ID as a fixed snapshot, API aliases for the models before 4.6, infrastructure limit, accessed 2026-11-12
- Claude Docs: Model deprecations - lifecycle states, 60-day notice, "Model status" table used by the script, accessed 2026-11-12
- Claude Code Docs: Model configuration - aliases, table by provider, order of model selection,
ANTHROPIC_DEFAULT_*_MODELvariables, alias history, accessed 2026-11-12 - Claude Code Docs: Settings - precedence between
ANTHROPIC_MODELand themodelfield, accessed 2026-11-12 - Claude API Reference: List models -
lifecycle,retires_at,linefields and pagination, accessed 2026-11-12
The scripts alias_history.py, model_audit.py and the flag test were run with Claude Code 2.1.322 and Python 3 on 2026-11-12, in their English versions; the blocks on modelUsage and on /v1/models require an account and were not run.
Commenti
Caricamento commenti...
Sign in to comment