Files
mz 82ce30ede2 fix(models): take completion limits from the model author
The generator merged every numeric limit with Math.max across all source
records, and ran that merge twice: once per provider/model and again when
duplicate provider records collapse into one canonical model. Resellers
routinely republish their context window as the completion limit, so one
outlier won the maximum: anthropic/claude-opus-5 and claude-sonnet-5 shipped
outputTokens 1000000 (LiteLLM deepinfra/anthropic records with
max_output_tokens 1000000), openai/gpt-6-astra 1050000 (models.dev
llmgateway limit.output) and z-ai/glm-5.3 / glm-5.3-flash 1048576. The router
forwards Math.max(maxTokens, outputTokens) to clients as the model's output
limit (packages/core/src/gateway/model-catalog.ts modelCatalogMaxOutputTokens),
so clients ask for more than the model accepts.

Completion limits now come from the model author. When the owning provider
(first-party aliases such as zai and zhipuai resolve to z-ai) publishes a
positive maxTokens or outputTokens, each of the two keys is the maximum over
the author's own records, and a key the author does not publish is omitted
rather than filled in from a reseller. Otherwise - the entry has no record
from its author, or the author publishes no completion limit - both keys keep
the previous maximum over every record. Context tokens and every other limit
are untouched, as is supports1MContext.

Regenerating from today's upstream sources gives 128000 / 128000 / 128000 /
131072 / 131072 (the client-visible max of maxTokens and outputTokens) for the
five reported ids, lowers 128 completion limits, raises none, leaves every
other limit and capability flag unchanged and never changes a model whose new
value comes from a provider other than its author. packages/core/models.json
is produced by the release workflow and `npm run models:build`, so it is not
part of this change.
2026-10-29 20:57:39 +03:00
..