Repository navigation
fix(models): read a relay's own capacity report and version notation - #1559
Open
pengwei269446668 wants to merge 2 commits into
Open
pengwei269446668 wants to merge 2 commits into
pengwei269446668 wants to merge 2 commits into
Conversation
An unidentified relay (a custom OpenAI-compatible endpoint such as a DeepSeek relay) lost its published context window when the models.dev authority landed: without an anchor the lookup dropped to the generic 128k text-only seed even though the owner published the exact id. Restore the pre-catalog relay rule: the model's own family names the publisher that owns its weights, and that owner's record answers an unanchored row (deepseek-v4-flash reads DeepSeek's 1M window again). Only the owner's exact record answers, one whitelisted deployment label may still be stripped, and the wire id is never rewritten.
A relay that serves an OpenAI-compatible list now states its own capacity, and its model names may use the owner's notation or canonical generation id. Three gaps made those rows fall back to the generic 128k/8192 seed: - A model list's `context_window` / `context_length` / `inputTokenLimit` / `contextWindow` (and the matching output keys) was discarded, so a service that plainly states 1,000,000 tokens was still enriched from elsewhere. Discovery keeps the reported value, and the settings row prefers it over both the catalog and any stored value (PiDeck parity: reported > catalog > nothing - an omission is never guessed). - A relay's dotted version name (`claude-sonnet-4.5`) never reached the owner's dashed published record (`claude-sonnet-4-5`). Each notation alias is now checked as a whole published id, alongside the existing single-whitelisted-deployment-label strip. - A relay naming the owner's canonical generation id (`deepseek-v4.1-flash`) found nothing, because the owner publishes that generation only under version aliases. The owner's own live (non-deprecated) record for the canonical id now answers. Only the weight owner's records may answer: reseller copies still never decide a window or a capability, the wire id is never rewritten, and a variant (`-thinking`, dated releases) or a generation the catalog does not publish stays unmatched.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A relay / custom OpenAI-compatible endpoint (e.g.
https://sidrune.aiservingdeepseek-v4-flash,claude-sonnet-4.5,gemini-3.1-pro) loses the context window its own model list publishes and falls back to the generic 128k / 8192 seed. Older versions (e.g. v0.16.0) resolved these; currentmaindoes not.Root cause:
62cf3c257 fix(models): use models.dev as metadata authorityremoved therelayChatMetadatafallback inmodels-dev-catalog.ts, so an unanchored relay id that the catalog does not publish verbatim got nothing. In addition, the service's own capacity report on its model-list row was discarded, and a relay naming a model in the owner's other notation (4.5vs4-5) or by the owner's canonical generation id never reached a record.Fix
model-discovery.ts,ipc/provider-ipc.ts). A model-list row that statescontext_window/context_length/inputTokenLimit/contextWindow(and the matching output keys) keeps that value, and the settings row prefers it over both the catalog and any stored value — PiDeck parity: reported > catalog > nothing. An omission is never guessed.models-dev-catalog.ts). A dotted version name (claude-sonnet-4.5) now reads the owner's dashed published record (claude-sonnet-4-5); each alias is checked as a whole published id, next to the existing single-whitelisted-deployment-label strip (-1m,-test, …).models-dev-catalog.ts). A relay naming the owner'scanonical_model_id(deepseek-v4.1-flash) is answered by the owner's own live (non-deprecated) record, since the owner publishes that generation only under version aliases.models-dev-catalog.ts,pi-model-metadata.ts). When no provider is anchored, only the weight owner's records for the family (claude→anthropic,gpt/o1/o3/o4→openai,gemini→google,grok→xai,mimo→xiaomi,glm→zai,deepseek→deepseek,kimi→moonshotai,minimax→minimax) may answer.Invariants preserved (approved #1047 matching rules):
-thinking, dated releases) and generations the catalog does not publish stay unmatched.Verification
models-dev-catalog.test.mjs+model-discovery.test.mjs: 69/69 pass.npx tsc -p tsconfig.json --noEmit: exit 0.9fa3abdee: no new failures (the only deltas are pre-existing, flaky, timeout-bound UI/Markdown tests that pass when run alone).deepseek-v4-flash → deepseek ctx=1000000 out=393216,claude-sonnet-4.5 → anthropic as=claude-sonnet-4-5,deepseek-v4.1-flash → deepseek as=deepseek-flash ctx=1000000,mimo-v2.5-pro-1m → xiaomi,some-private-model → UNMATCHED.Known pre-existing failures (not touched here)
provider-endpoint-metadata.test.mjs: on Windows the fixture usesnew URL(...).pathname, which yields/E:/…with a leading slash, soreadFilefails. Fails onmaintoo.model-binding-catalog-source.test.mjs: catalog drift (1048576vs1050000).🤖 Generated with Claude Code