Keep model IDs in one place, so a retirement is a one-line change
Finding retired model IDs is a detection problem. This guide is about prevention: how to structure code and config so that when the next notice arrives, you change one value, run your tests and ship. With retirement notices now as short as 60 days, the difference between “one value” and “forty call sites across six repositories” is the difference between an afternoon and a sprint.
1. Name models by role, not by version
Code should ask for what the model is for, not which model it is. Define a small set of roles that match how your product uses models:
# models.py: the only file that names a model
MODELS = {
"summarize": {"provider": "anthropic", "id": "<model ID from config>"},
"classify": {"provider": "anthropic", "id": "<model ID from config>"},
"embed": {"provider": "openai", "id": "<model ID from config>"},
}
def model_for(role: str) -> dict:
return MODELS[role]Call sites then use model_for("summarize"). When a model retires, you change the entry for each role that used it, and nothing else.
2. Keep request options next to the model
Models differ in which parameters they accept. Newer Claude models, for example, reject temperature, top_p and top_k. If options live in the call site, a model change breaks requests in places you didn't edit. Put them in the same entry:
"summarize": {
"provider": "anthropic",
"id": "<model ID>",
"options": {"max_tokens": 1024}, # no sampling params for this model
},3. Load IDs from config, with no silent default
A common pattern is os.getenv("MODEL_ID", "some-model"). The default looks harmless, but it is a second copy of the model ID that nobody updates, and it is used exactly when something is misconfigured, such as in a cron job or a new environment. Prefer failing loudly:
model_id = os.environ["SUMMARIZE_MODEL_ID"] # KeyError if unset, on purpose4. Parameterize infrastructure and notebooks
- Terraform: pass model IDs as variables from one
tfvarsfile rather than hardcoding them in resources or IAM policy documents. - Notebooks: import the same
modelsmodule, or read the same config file, at the top of the notebook. A model string pasted into a cell is the most common leftover after a migration. - Evaluation scripts: these sometimes pin a model on purpose, to compare against a baseline. Mark those pins with a comment and a date so they are easy to review.
5. Aliases or dated IDs?
Some providers offer short aliases that point to a current model as well as dated, fixed IDs. Aliases reduce edits but can change behavior under you; dated IDs are predictable but retire. Check your provider's documentation for how its aliases behave, then decide per role. A reasonable default: dated IDs in production for predictable outputs, kept in one place, with a test that watches for retirement.
6. Add a test that fails before the provider does
Keep a list of retired and retiring IDs with dates, and a unit test that fails if any configured model is on it, or will retire within, say, 30 days:
def test_no_retiring_models():
for role, cfg in MODELS.items():
date = RETIRING.get(cfg["id"])
assert date is None or date > today() + timedelta(days=30), roleThe list must come from the providers' deprecation pages and needs updating when notices arrive. See finding deprecated model IDs for how to build it, and the 60-day runbook for what to do when the test fails.
What this doesn't solve
Centralizing helps inside one repository. Across many repositories, services and teams, each one has its own config, and someone still has to check them all. That cross-repository view is the problem SunsetLint solves.