Skip to content

Commit e1e8dbb

Browse files
xydttswclaude
andcommitted
fix(zai): fall back to default baseUrl when template lacks one for catalog models
Static catalog model entries from the plugin manifest do not carry a per-model baseUrl - it is only set at the provider level. When ctx.providerConfig is undefined (no user config for zai provider) and the template model from the registry also lacks baseUrl, the resolved runtime model ends up without a baseUrl. This causes the OpenAI-compatible transport to fall back to OpenAI's default API host, producing confusing 401 errors for what should be Z.ai API calls. Add ZAI_GLOBAL_BASE_URL as the final fallback so catalog models always resolve with their expected base URL. Fixes #94269 Co-Authored-By: Claude <[email protected]>
1 parent 0cae5b3 commit e1e8dbb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

extensions/zai/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { fetchZaiUsage } from "openclaw/plugin-sdk/provider-usage";
3434
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
3535
import { detectZaiEndpoint, type ZaiEndpointId } from "./detect.js";
3636
import { zaiMediaUnderstandingProvider } from "./media-understanding-provider.js";
37-
import { buildZaiModelDefinition } from "./model-definitions.js";
37+
import { buildZaiModelDefinition, ZAI_GLOBAL_BASE_URL } from "./model-definitions.js";
3838
import { applyZaiConfig, applyZaiProviderConfig, resolveZaiModelId } from "./onboard.js";
3939

4040
const PROVIDER_ID = "zai";
@@ -104,7 +104,7 @@ function resolveGlm5ForwardCompatModel(
104104
...template,
105105
id: def.id,
106106
name: def.name,
107-
baseUrl: ctx.providerConfig?.baseUrl ?? template?.baseUrl,
107+
baseUrl: ctx.providerConfig?.baseUrl ?? template?.baseUrl ?? ZAI_GLOBAL_BASE_URL,
108108
api: "openai-completions",
109109
provider: PROVIDER_ID,
110110
reasoning: def.reasoning,

0 commit comments

Comments
 (0)