Skip to content

feat(models): add mainland-China vendor sections to the model catalog#259

Merged
su-fen merged 1 commit into
mainfrom
feat/cn-model-catalog
Jul 24, 2026
Merged

feat(models): add mainland-China vendor sections to the model catalog#259
su-fen merged 1 commit into
mainfrom
feat/cn-model-catalog

Conversation

@su-fen

@su-fen su-fen commented Jul 24, 2026

Copy link
Copy Markdown
Member

目标

#258 的跨供应商限额回查基础上,把国内主流厂商的模型元数据纳入目录:快照从 4 家 105 个模型扩展到 13 个分区 233 个模型。国内厂商没有对应的应用供应商类型,这些分区只经 findCatalogModelAcrossProviders 消费——deepseek/glm/qwen/kimi 等模型经 Anthropic/OpenAI 兼容中转配在任一供应商类型下,都能解析出真实的上下文窗口与输出上限,应用侧无需新增供应商类型。

新增分区

分区 上游来源(首源优先) 模型数
deepseek deepseek 4
zhipuai zai + zhipuai(zai 为超集) 14
moonshotai moonshotai-cn + moonshotai 10
minimax minimax-cn + minimax 7
stepfun stepfun 5
xiaomi xiaomi 6
longcat longcat 1
alibaba alibaba-cn + alibaba(国内站限额优先) 76
tencent tencent-coding-plan(上游无裸 tencent) 5

上游(models.dev)未收录百度文心与字节豆包,待上游补充后刷新快照即可获得。

关键设计

  • generate-model-catalog.mjs:PROVIDERS 平铺列表 → SECTIONS。每分区可并集多个上游 key(同厂商国内/国际站合并,首源优先;qwen-max 等两站限额不一致的以国内站为准)。
  • 上游污染在生成期处理:百炼(alibaba-cn)与腾讯 coding-plan 本身是聚合平台,混入了 glm/kimi/MiniMax/deepseek 的第三方托管副本,且限额是平台侧钳过的(如腾讯的 glm-5 = 202752/16384,官方 = 204800/131072)。生成期按小写 id 全目录去重,SECTIONS 声明序即裁决优先级——厂商官方分区在前、污染平台殿后,副本让位官方值;siliconflow/…kimi/… 等聚合前缀 id 直接过滤。百炼独有且无冲突的 deepseek-v3/deepseek-r1 等历史部署 id 有意保留(中转常用这些 id,扩大命中面)。
  • 查找索引加小写别名modelCatalog.ts,两端镜像):MiniMax-M2.5、LongCat-2.0 等混合大小写目录 id,小写配置也能命中;别名无歧义由生成期小写去重保证。
  • 不变量升级:目录 id 唯一性从"全局唯一"升级为"全局小写唯一";测试中的分区键序与质量门(每分区条目数下限)与生成脚本 SECTIONS 锁同值。

测试

  • 新增用例:分区键序断言、小写唯一不变量、国内模型跨供应商回查(deepseek-chat/glm-4.6/qwen-max/kimi-k2.5)、小写别名命中(minimax-m2.5 → MiniMax-M2.5)、settings 默认值(deepseek-chat 配 claude_code 下 = 1M/384K 等)。
  • 生成器 --check 幂等通过;GUI test:frontend 1222 通过、Web npm test 413 通过、两端 tsc --noEmit 与 biome 干净、check-mirror.mjs 104 个文件一致。

🤖 Generated with Claude Code

Extend the models.dev snapshot from the four native provider catalogs
(105 models) to 13 sections (233 models), adding deepseek, zhipuai,
moonshotai, minimax, stepfun, xiaomi, longcat, alibaba and tencent.
These vendors have no app provider type of their own; their sections
are consumed exclusively through findCatalogModelAcrossProviders, so
models served via Anthropic/OpenAI-compatible relays under any
provider type now resolve real context/output limits.

- generate-model-catalog.mjs: replace the flat PROVIDERS list with
  SECTIONS. Each section unions one or more upstream keys (first
  source wins; CN endpoints preferred where both exist, e.g.
  alibaba-cn's qwen-max limits over the stale global entry).
- Upstream contamination handled at generation time: Bailian
  (alibaba-cn) and tencent-coding-plan host third-party models
  (glm/kimi/MiniMax/deepseek) with platform-clamped limits. Ids are
  deduplicated case-insensitively across sections in declaration
  order — pure vendor-official catalogs first, contaminated platforms
  last — and aggregator-prefixed ids (siliconflow/…, kimi/…) are
  filtered out. Bailian-only historical deployments (deepseek-v3,
  deepseek-r1, distills) are kept intentionally: relays commonly
  serve those ids.
- modelCatalog.ts (mirrored): the lookup index adds lowercase aliases
  so mixed-case catalog ids (MiniMax-M2.5, LongCat-2.0) match
  lowercase configs; generation-time lowercase dedup guarantees the
  aliases are unambiguous.
- Tests: section keys/order and per-section quality gates locked to
  the generator's SECTIONS; global uniqueness upgraded to
  lowercase-uniqueness; cross-provider and settings-defaults cases
  for the new vendors.

models.dev does not list Baidu ERNIE or ByteDance Doubao; those can
be picked up by a snapshot refresh once upstream adds them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@su-fen
su-fen merged commit 2fc7100 into main Jul 24, 2026
7 checks passed
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