Skip to content

refactor(llm): Share one model table type across providers - #1212

Merged
JeanMertz merged 1 commit into
mainfrom
one-model-table
Sep 30, 2026
Merged

JeanMertz merged 1 commit into
mainfrom
one-model-table

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

The OpenAI, Google, Anthropic and Cerebras providers each kept their hand-maintained model facts in a match over model ids. They now use a shared Catalog<T> in jp_llm::model::catalog, named MODEL_OVERRIDES with a model_overrides(id) lookup in every provider. An entry lists its canonical id and any aliases (dated snapshots, -latest pointers, gpt-5.6 / gpt-5.6-sol), and a lookup under an alias still reports the id the caller named. Each provider keeps its own value type: ModelDetails where the API reports little or nothing, and ModelOverrides for Anthropic, whose table only fills gaps in the capabilities API.

A match could look up one id but could not be iterated, so OpenAI kept a separate SUBSCRIPTION_MODELS list for subscription credentials, and it had drifted: gpt-6-sol and gpt-6-luna were marked as served by a ChatGPT subscription but missing from the list. The list is now derived from the entries marked subscription: Some(true), so a subscription credential lists both models, and the two can no longer disagree.

Every provider has a test that no id is claimed by two entries, which the compiler used to catch as an unreachable match arm.

The OpenAI, Google, Anthropic and Cerebras providers each kept their
hand-maintained model facts in a `match` over model ids. They now use a
shared `Catalog<T>` in `jp_llm::model::catalog`, named
`MODEL_OVERRIDES` with a `model_overrides(id)` lookup in every provider.
An entry lists its canonical id and any aliases (dated snapshots,
`-latest` pointers, `gpt-5.6` / `gpt-5.6-sol`), and a lookup under an
alias still reports the id the caller named. Each provider keeps its own
value type: `ModelDetails` where the API reports little or nothing, and
`ModelOverrides` for Anthropic, whose table only fills gaps in the
capabilities API.

A `match` could look up one id but could not be iterated, so OpenAI
kept a separate `SUBSCRIPTION_MODELS` list for subscription credentials,
and it had drifted: `gpt-6-sol` and `gpt-6-luna` were marked as served
by a ChatGPT subscription but missing from the list. The list is now
derived from the entries marked `subscription: Some(true)`, so a
subscription credential lists both models, and the two can no longer
disagree.

Every provider has a test that no id is claimed by two entries, which
the compiler used to catch as an unreachable `match` arm.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz
JeanMertz added this pull request to stack #1215 September 30, 2026 10:57
@JeanMertz
JeanMertz merged commit 551819b into main Sep 30, 2026
22 checks passed
@JeanMertz
JeanMertz deleted the one-model-table branch September 30, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant