Conversation
…eign provider Relay/aggregator setups often attach one vendor's model to another vendor's provider type (e.g. grok-4.5 on an Anthropic-compatible relay). The catalog lookup was scoped to the provider's own section, so such models missed and fell back to the provider fallback limits (grok-4.5 under claude_code showed 200K/32K instead of its real 500K/32K). - modelCatalog.ts (mirrored): add findCatalogModelAcrossProviders / resolveModelLimitsAcrossProviders (id is globally unique across the catalog, locked by the invariants test) and repairStaleCrossProviderLimits for limits persisted before this fix. - getProviderModelDefaults (both frontends): scoped hit -> claude_code [1m]/adaptive heuristics -> cross-provider lookup -> provider fallback. The heuristic stays ahead of the lookup because a [1m] suffix is the user's explicit deployment-window declaration; the Anthropic window policy only governs catalog Anthropic models, so cross-provider hits pass catalog values through untouched. - normalizeProviderModelConfig (both frontends): repair stored limits that exactly equal the provider fallback pair when the model only resolves in a foreign catalog section, so existing configs fix themselves on read without re-adding the model. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
问题
各供应商原生目录下的模型限额显示正确,但把 A 家模型配置到 B 家供应商类型下(中转聚合的常见用法)时元数据错误。最典型的例子:grok-4.5 在 xai 供应商下显示正确的 500K/32K,配到 Anthropic 兼容供应商下却显示 claude_code 兜底值 200K/32K。
根因:目录查找
getProviderModelDefaults只在本供应商类型对应的目录分区里检索,跨供应商配置必然 miss 并落到本供应商兜底限额。修复
lib/models/modelCatalog.ts(镜像文件,两端字节一致)findCatalogModelAcrossProviders/resolveModelLimitsAcrossProviders:按模型 id 跨全部目录分区回查,装饰 id 候选链(大小写、@版本、[1m]、日期后缀)同样生效;目录 id 全局唯一已由不变量测试锁死,回查无歧义。repairStaleCrossProviderLimits:修复本 fix 之前已落库的坏默认值——存量恰等于本供应商兜底对、且模型只在别家目录分区可命中时替换为真实限额;任一值偏离兜底对即视为用户显式配置,原样保留。两端
lib/settings/index.ts(GUI 与 WebUI 手动同步)getProviderModelDefaults查找顺序:本供应商目录命中 → claude_code 的[1m]/adaptive 启发式 → 跨供应商回查(新增) → 供应商兜底。启发式优先于回查是刻意的:[1m]后缀是用户对部署窗口的显式声明;Anthropic 的 1M/adaptive 窗口策略只约束目录内的 Anthropic 模型,跨供应商命中直接透传目录值。normalizeProviderModelConfig读侧接入存量修复:已存在的错误配置打开设置即自动修正,无需删除重加。行为确认
[1m]/adaptive 启发式与窗口钳制:行为全部不变(anthropic-long-context 测试零改动通过)。context-1mbeta 头——与用户手动配置 500K 的既有行为一致。测试
repairStaleCrossProviderLimits四种边界、getProviderModelDefaults三个方向的跨供应商解析与优先级、读侧存量修复。test:frontend1222 通过、Webnpm test413 通过、两端tsc --noEmit与 biome 干净、scripts/check-mirror.mjs104 个文件全部一致。🤖 Generated with Claude Code