fix(kimi-web, qwen-web): align model catalog with live /models + map scenario per model - #5915
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the model definitions and configuration for the kimi-web provider, transitioning to the k2d6 model family (k2d6 and k2d6-thinking) and adding dynamic model discovery. It also removes an incorrect alias for qwen3-coder-plus in the qwen-web executor. Feedback suggests defensively validating that availableModels is an array in the model discovery parser to prevent potential runtime crashes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const list = (data?.availableModels || []) as Array<{ | ||
| key?: string; | ||
| displayName?: string; | ||
| thinking?: boolean; | ||
| }>; |
There was a problem hiding this comment.
To prevent potential runtime crashes (e.g., TypeError: list.filter is not a function) if the upstream API returns an unexpected response structure where availableModels is not an array, we should defensively validate that it is an array using Array.isArray before processing.
| const list = (data?.availableModels || []) as Array<{ | |
| key?: string; | |
| displayName?: string; | |
| thinking?: boolean; | |
| }>; | |
| const list = (Array.isArray(data?.availableModels) ? data.availableModels : []) as Array<{ | |
| key?: string; | |
| displayName?: string; | |
| thinking?: boolean; | |
| }>; |
|
Thanks for the kimi-web/qwen-web catalog work, @janeza2! 🙏 The intent is great, but this PR can't be reviewed/merged in its current shape: it touches ~100 files with +41,904/−11,970 lines — including Could you please:
Once it's a focused diff (ideally with a test asserting the catalog matches the live |
Update the kimi-web catalog and request scenario selection to match www.kimi.com's live GetAvailableModels response.
Keep qwen3-coder-plus as its own model because it is present in the live Qwen web models catalog.
7a5df63 to
356948f
Compare
|
Updated the branch as requested.
Verification:
|
…scenario per model (diegosouzapw#5915) * fix(kimi-web): align catalog with live models Update the kimi-web catalog and request scenario selection to match www.kimi.com's live GetAvailableModels response. * fix(qwen-web): stop aliasing qwen3-coder-plus Keep qwen3-coder-plus as its own model because it is present in the live Qwen web models catalog.
Summary
Two follow-up fixes to the qwen-web / kimi-web migrations that landed in #5855 / #5858 (now in
release/v3.8.43):{ kimi-default, kimi-k2.6, kimi-128k }— none of those ids exist inwww.kimi.com's real/apiv2/kimi.gateway.config.v1.ConfigService/GetAvailableModelsresponse. Likewisescenariowas pinned toSCENARIO_K2D5for every request, so the (never-shipped) thinking variant could never have selected itself.MODEL_ALIASEShad"qwen3-coder-plus": "qwen3.7-max", butqwen3-coder-plusis its own entry inGET /api/v2/models— the alias silently rewrote every coder request to the wrong model.Evidence — Kimi catalog
Live capture of
GetAvailableModels:{ "availableModels": [ { "key": "k2d6", "displayName": "K2.6 Instant", "scenario": "SCENARIO_K2D5" }, { "key": "k2d6-thinking", "displayName": "K2.6 Thinking", "scenario": "SCENARIO_K2D5", "thinking": true }, { "key": "k2d6-agent", "displayName": "K2.6 Agent", "scenario": "SCENARIO_OK_COMPUTER" }, { "key": "k2d6-agent-ultra","displayName": "K2.6 Agent Swarm","scenario": "SCENARIO_OK_COMPUTER" } ], "defaultScenario": { "scenario": "SCENARIO_K2D5" } }Only the two chat-tier variants are exposed. Agent variants are filtered out — they need
SCENARIO_OK_COMPUTERpluskimiPlusId/agentModebody fields that this executor doesn't shape; users who need agentic Kimi should use thekimi-coding(api.kimi.com) provider.Evidence — Qwen catalog
Live capture of
https://chat.qwen.ai/api/v2/models(22 entries) includesqwen3-coder-plusas a real id:{ "id": "qwen3-coder-plus", "name": "Qwen3-Coder", "object": "model", "owned_by": "qwen", ... }Changes
Commit 1 — kimi-web catalog + scenario + discovery
open-sse/config/providers/registry/kimi/web/index.ts— catalog rewritten to[{k2d6, K2.6 Instant}, {k2d6-thinking, K2.6 Thinking, supportsReasoning}]open-sse/executors/kimi-web.ts— new exportedresolveModelConfig(modelId) → { scenario, thinking }driven by the catalog truth.buildRequestBodynow takes the resolved scenario and threads it into both top-levelscenarioandmessage.scenario(SPA sends both). Heuristic regex for thinking is removed; the only override isreasoning_effort: "none".src/app/api/providers/[id]/models/discovery/providerModelsConfig.ts— newkimi-webentry pointing atGetAvailableModelswithauthHeader: "Authorization"+authPrefix: "Bearer ". Agent variants filtered at parse time.resolveModelConfigtest cases (k2d6-thinking / k2d6 / unknown fallback); existing execution tests updated from retiredkimi-defaultto realk2d6.Commit 2 — qwen-web alias fix
open-sse/executors/qwen-web.ts— drop"qwen3-coder-plus": "qwen3.7-max"fromMODEL_ALIASES(with a comment explaining why).qwen3-coder-flashkeeps its alias (not in live catalog).Test plan
npm run typecheck:core— passes (only pre-existing unrelatedappConfig.tserrors)node:testtypes + L450+ errors inweb-cookie-providers-new.test.tsexist onrelease/v3.8.43already)GetAvailableModelscapture confirms the new catalog ids and scenario mappingtest-unit— needs upstream CI to runNotes
release/v3.8.43(notmain) because that's where fix(qwen-web): unblock validator + chat completion (retired endpoint + missing SPA version header) #5855 / fix(kimi-web): migrate to www.kimi.com Connect-RPC API (kimi.moonshot.cn retired) #5858 landed. The PR targetsrelease/v3.8.43.kimi-webdiscovery entry is the first one to useAuthorization: Beareragainst a JSON (non-Connect-framed) endpoint onwww.kimi.com. TheGetAvailableModelsresponse is plain JSON — only the chat completion endpoint uses the 5-byte Connect envelope.