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:
@@ -306,7 +306,7 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
||||
websiteUrl: "https://open.bigmodel.cn",
|
||||
apiKeyUrl: "https://www.bigmodel.cn/claude-code?ic=RRVJPB5SII",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
||||
baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [
|
||||
@@ -324,8 +324,8 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://open.bigmodel.cn/api/paas/v4",
|
||||
defaultValue: "https://open.bigmodel.cn/api/paas/v4",
|
||||
placeholder: "https://open.bigmodel.cn/api/coding/paas/v4",
|
||||
defaultValue: "https://open.bigmodel.cn/api/coding/paas/v4",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
@@ -344,7 +344,7 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
||||
websiteUrl: "https://z.ai",
|
||||
apiKeyUrl: "https://z.ai/subscribe?ic=8JVLJQFSKB",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api.z.ai/v1",
|
||||
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [
|
||||
@@ -362,8 +362,8 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://api.z.ai/v1",
|
||||
defaultValue: "https://api.z.ai/v1",
|
||||
placeholder: "https://api.z.ai/api/coding/paas/v4",
|
||||
defaultValue: "https://api.z.ai/api/coding/paas/v4",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
|
||||
Reference in New Issue
Block a user