mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
[codex] fix Zhipu coding plan presets (#3524)
* fix(presets): update Zhipu coding plan endpoints
* fix(model-fetch): probe /models on versioned /vN base URLs
The model-list probe assumed any base URL not ending in /v1 needs /v1/models appended. For providers whose base URL already ends in a version segment like /v4 (Zhipu/Z.AI GLM Coding Plan at .../api/coding/paas/v4), this produced .../v4/v1/models which 404s, so the "Fetch models" button always failed.
Detect a trailing /v{N} version segment and probe {base}/models first, keeping /v1/models as a fallback candidate for non-/v1 versions. Fixes Codex/OpenCode/OpenClaw/Hermes GLM presets and any other vN-style endpoint, with no behavior change for /v1 or non-versioned URLs.
---------
Co-authored-by: Jason <farion1231@gmail.com>
This commit is contained in:
@@ -44,14 +44,14 @@ const expectedChatPresets = new Map<
|
||||
[
|
||||
"Zhipu GLM",
|
||||
{
|
||||
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
||||
baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4",
|
||||
contextWindows: { "glm-5.1": 200000 },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Zhipu GLM en",
|
||||
{
|
||||
baseUrl: "https://api.z.ai/api/paas/v4",
|
||||
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
||||
contextWindows: { "glm-5.1": 200000 },
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user