Files
ops-docs/maintenance/model-transitions.md
T
inference-admin 02a75a1868 runbook: model transitions (repoint vs rename), with the three lists to keep in step
Written from today's DeepSeek 1017 repoint: the spend-log measurement that chose
repointing (3,014 calls on the prefixed id vs 84 on the alias), the aliases that
duplicate litellm_params and must move with the pointer, the emission-factor keys
that silently degrade on a rename, and the picker that only needs touching when
the id changes. Verification is a spend row, not an HTTP 200.
2026-11-16 20:12:44 +00:00

70 lines
3.9 KiB
Markdown

# Model transitions (changing what a gateway model serves)
A provider retires or replaces a model we serve. The gateway can absorb this in two
shapes, and picking the right one is the first decision, not a detail.
**Repoint or rename.**
- **Repoint** — keep the `model_name`, change only `litellm_params.model` and
`model_info` prices. No member config breaks. Use this whenever clients may pin the
prefixed id.
- **Rename** — a new `model_name`. Honest about the version, but every client config
pinned to the old id starts returning `400 Invalid model name … Call /v1/models`.
We cannot see those configs.
**Measure before choosing.** Spend logs record the *requested* name in `model_group`
and the upstream string in `model`. Group one page of `/spend/logs` and compare traffic
on the alias vs the prefixed id:
```python
rows = GET https://gateway.inference.coop/spend/logs # master key
Counter((r["model_group"], r["model"]) for r in rows if "deepseek" in r["model_group"])
```
On 2026-11-16 that comparison was 3,014 calls on `greenpt/deepseek-v4.1-flash` against
84 on `deepseek-flash-green` — which settled it in favour of repointing.
## Checklist
1. **`config.yaml` (gateway)** — update the pointer `litellm_params.model` **and** the
`model_info` prices. Do it for **every deployment that carries its own copy**: the
provider-prefixed entry *and* any alias that duplicates the params
(`deepseek-flash-green` is a separate entry with its own pointer and prices — miss
it and the alias keeps billing the old rate). Update the header price comment and the
entry comment, since a repointed name no longer says which snapshot it serves.
2. **`librechat.yaml` (chat picker)** — only needed on a RENAME. The picker is a
hand-maintained list of provider-prefixed ids in two places: `models.default` and
each `modelSpecs` entry's `label` + `preset.model`. A repoint needs no picker change.
(`models.fetch: true` does not add entries to the visible dropdown — verified by
observation, not by reading the config.)
3. **Portal emission factors** — `member-portal/metrics_snapshot.py` keys Wh/1k-out and
gCO2e factors on the model-group name, and `app/main.py` carries a display-name map.
A RENAME requires updating both or Energy/Carbon silently drops from MEASURED to
unmeasured. A repoint needs nothing.
4. **Docs** — `docs/models.md` (default line and the table row: price + which snapshot),
`docs/api-access.md` alias table (only if the id changes), `docs/energy.md` (only if
renamed), `ops-docs/provider-pricing/<provider>.md`.
5. **Validate** — `python3 validate_config.py litellm config.yaml`. Fail-closed: an
unknown top-level key or unresolvable provider prefix refuses the build.
6. **Build, pin, deploy.**
7. **Verify by spend row, not by HTTP 200.** A successful call proves nothing about
what it pointed at. Read the newest `/spend/logs` row: `model_group` must be the name
you called and `model` must be the provider's new upstream string. Confirm aliases
bill under their own name.
8. **Tell members** — append a line to `~/.hermes/cron/updates_notes.jsonl` and it lands
in the next digest's Stewarding section; recommend pinning the alias.
9. **Record** — comment on the originating issue/PR with the shape chosen and why.
## Deprecating a name instead of deleting it
If a rename is eventually wanted, add the versioned id **alongside** the old one (both
pointing at the same upstream), tell members to migrate, and remove the old entry only
when `model_group` traffic on it reads zero for a full cycle. That trigger is measurable,
so retirement is a data decision rather than a judgement call.
## Three independent lists
`config.yaml` (what exists), `librechat.yaml` (what the chat offers), and the docs alias
table (what members are told) are separate lists. A single transition touches all three;
repointing touches one. That asymmetry is the strongest argument for repointing.