Skip to content

Commit 088f721

Browse files
committed
fix: update Z.AI endpoint to use improved coding API
- Changed international Z.AI endpoint from /api/paas/v4 to /api/coding/paas/v4 - Updated corresponding tests to reflect the new endpoint - This improves tool-calling capabilities for GLM models as documented by Z.AI Fixes #7895
1 parent 8fee312 commit 088f721

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/api/providers/__tests__/zai.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ describe("ZAiHandler", () => {
4141

4242
it("should use the correct international Z AI base URL", () => {
4343
new ZAiHandler({ zaiApiKey: "test-zai-api-key", zaiApiLine: "international" })
44-
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://api.z.ai/api/paas/v4" }))
44+
expect(OpenAI).toHaveBeenCalledWith(
45+
expect.objectContaining({ baseURL: "https://api.z.ai/api/coding/paas/v4" }),
46+
)
4547
})
4648

4749
it("should use the provided API key for international", () => {
@@ -109,7 +111,9 @@ describe("ZAiHandler", () => {
109111
describe("Default behavior", () => {
110112
it("should default to international when no zaiApiLine is specified", () => {
111113
const handlerDefault = new ZAiHandler({ zaiApiKey: "test-zai-api-key" })
112-
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://api.z.ai/api/paas/v4" }))
114+
expect(OpenAI).toHaveBeenCalledWith(
115+
expect.objectContaining({ baseURL: "https://api.z.ai/api/coding/paas/v4" }),
116+
)
113117

114118
const model = handlerDefault.getModel()
115119
expect(model.id).toBe(internationalZAiDefaultModelId)

src/api/providers/zai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ZAiHandler extends BaseOpenAiCompatibleProvider<InternationalZAiMod
2121
super({
2222
...options,
2323
providerName: "Z AI",
24-
baseURL: isChina ? "https://open.bigmodel.cn/api/paas/v4" : "https://api.z.ai/api/paas/v4",
24+
baseURL: isChina ? "https://open.bigmodel.cn/api/paas/v4" : "https://api.z.ai/api/coding/paas/v4",
2525
apiKey: options.zaiApiKey ?? "not-provided",
2626
defaultProviderModelId: defaultModelId,
2727
providerModels: models,

0 commit comments

Comments
 (0)