From bd28eb9f5bc614d0ca170cdcb2df556c6b6c945c Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 22 Mar 2026 17:51:18 -0700 Subject: [PATCH] fix(zai): align remaining pi metadata --- extensions/zai/model-definitions.test.ts | 25 ++++++++++++++++++++++-- extensions/zai/model-definitions.ts | 18 ++++++++--------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/extensions/zai/model-definitions.test.ts b/extensions/zai/model-definitions.test.ts index 22e2bc7e484..615ccf3c91b 100644 --- a/extensions/zai/model-definitions.test.ts +++ b/extensions/zai/model-definitions.test.ts @@ -7,8 +7,8 @@ describe("zai model definitions", () => { id: "glm-5", reasoning: true, input: ["text"], - contextWindow: 204800, - maxTokens: 131072, + contextWindow: 202800, + maxTokens: 131100, cost: ZAI_DEFAULT_COST, }); }); @@ -29,4 +29,25 @@ describe("zai model definitions", () => { cost: { input: 0.2, output: 1.1, cacheRead: 0.03, cacheWrite: 0 }, }); }); + + it("keeps the remaining GLM 4.7/5 pricing and token limits aligned with Pi", () => { + expect(buildZaiModelDefinition({ id: "glm-4.7-flash" })).toMatchObject({ + id: "glm-4.7-flash", + cost: { input: 0.07, output: 0.4, cacheRead: 0, cacheWrite: 0 }, + contextWindow: 200000, + maxTokens: 131072, + }); + expect(buildZaiModelDefinition({ id: "glm-4.7-flashx" })).toMatchObject({ + id: "glm-4.7-flashx", + cost: { input: 0.06, output: 0.4, cacheRead: 0.01, cacheWrite: 0 }, + contextWindow: 200000, + maxTokens: 128000, + }); + expect(buildZaiModelDefinition({ id: "glm-5-turbo" })).toMatchObject({ + id: "glm-5-turbo", + contextWindow: 202800, + maxTokens: 131100, + cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 }, + }); + }); }); diff --git a/extensions/zai/model-definitions.ts b/extensions/zai/model-definitions.ts index a75fe2e0bc6..ce59be40f75 100644 --- a/extensions/zai/model-definitions.ts +++ b/extensions/zai/model-definitions.ts @@ -28,16 +28,16 @@ const ZAI_MODEL_CATALOG = { name: "GLM-5", reasoning: true, input: ["text"], - contextWindow: 204800, - maxTokens: 131072, + contextWindow: 202800, + maxTokens: 131100, cost: ZAI_DEFAULT_COST, }, "glm-5-turbo": { name: "GLM-5 Turbo", reasoning: true, input: ["text"], - contextWindow: 200000, - maxTokens: 131072, + contextWindow: 202800, + maxTokens: 131100, cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 }, }, "glm-4.7": { @@ -54,15 +54,15 @@ const ZAI_MODEL_CATALOG = { input: ["text"], contextWindow: 200000, maxTokens: 131072, - cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, + cost: { input: 0.07, output: 0.4, cacheRead: 0, cacheWrite: 0 }, }, "glm-4.7-flashx": { name: "GLM-4.7 FlashX", reasoning: true, input: ["text"], contextWindow: 200000, - maxTokens: 131072, - cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, + maxTokens: 128000, + cost: { input: 0.06, output: 0.4, cacheRead: 0.01, cacheWrite: 0 }, }, "glm-4.6": { name: "GLM-4.6", @@ -148,7 +148,7 @@ export function buildZaiModelDefinition(params: { input: params.input ?? (catalog?.input ? ([...catalog.input] as ("text" | "image")[]) : ["text"]), cost: params.cost ?? catalog?.cost ?? ZAI_DEFAULT_COST, - contextWindow: params.contextWindow ?? catalog?.contextWindow ?? 204800, - maxTokens: params.maxTokens ?? catalog?.maxTokens ?? 131072, + contextWindow: params.contextWindow ?? catalog?.contextWindow ?? 202800, + maxTokens: params.maxTokens ?? catalog?.maxTokens ?? 131100, }; }