diff --git a/packages/types/src/providers/zai.ts b/packages/types/src/providers/zai.ts index 69f90f232a5..d054903e34f 100644 --- a/packages/types/src/providers/zai.ts +++ b/packages/types/src/providers/zai.ts @@ -5,6 +5,7 @@ import { ZaiApiLine } from "../provider-settings.js" // https://docs.z.ai/guides/llm/glm-4-32b-0414-128k // https://docs.z.ai/guides/llm/glm-4.5 // https://docs.z.ai/guides/llm/glm-4.6 +// https://docs.z.ai/guides/llm/glm-5.1 // https://docs.z.ai/guides/overview/pricing // https://bigmodel.cn/pricing @@ -135,6 +136,21 @@ export const internationalZAiModels = { description: "GLM-5 is Zhipu's next-generation model with a 202k context window and built-in thinking capabilities. It delivers state-of-the-art reasoning, coding, and agentic performance.", }, + "glm-5.1": { + maxTokens: 131_072, + contextWindow: 200_000, + supportsImages: false, + supportsPromptCache: true, + supportsReasoningEffort: ["disable", "medium"], + reasoningEffort: "medium", + preserveReasoning: true, + inputPrice: 1.4, + outputPrice: 4.4, + cacheWritesPrice: 0, + cacheReadsPrice: 0.26, + description: + "GLM-5.1 is Zhipu's most capable model with a 200k context window, 128k max output, and built-in thinking capabilities. It delivers top-tier reasoning, coding, and agentic performance.", + }, "glm-4.7-flash": { maxTokens: 16_384, contextWindow: 200_000, @@ -311,6 +327,21 @@ export const mainlandZAiModels = { description: "GLM-5 is Zhipu's next-generation model with a 202k context window and built-in thinking capabilities. It delivers state-of-the-art reasoning, coding, and agentic performance.", }, + "glm-5.1": { + maxTokens: 131_072, + contextWindow: 204_800, + supportsImages: false, + supportsPromptCache: true, + supportsReasoningEffort: ["disable", "medium"], + reasoningEffort: "medium", + preserveReasoning: true, + inputPrice: 0.68, + outputPrice: 2.28, + cacheWritesPrice: 0, + cacheReadsPrice: 0.13, + description: + "GLM-5.1 is Zhipu's most capable model with a 200k context window, 128k max output, and built-in thinking capabilities. It delivers top-tier reasoning, coding, and agentic performance.", + }, "glm-4.7-flash": { maxTokens: 16_384, contextWindow: 204_800, diff --git a/src/api/providers/__tests__/zai.spec.ts b/src/api/providers/__tests__/zai.spec.ts index 34323b108d3..b748be20701 100644 --- a/src/api/providers/__tests__/zai.spec.ts +++ b/src/api/providers/__tests__/zai.spec.ts @@ -98,6 +98,24 @@ describe("ZAiHandler", () => { expect(model.info.preserveReasoning).toBe(true) }) + it("should return GLM-5.1 international model with thinking support and 128k max output", () => { + const testModelId: InternationalZAiModelId = "glm-5.1" + const handlerWithModel = new ZAiHandler({ + apiModelId: testModelId, + zaiApiKey: "test-zai-api-key", + zaiApiLine: "international_coding", + }) + const model = handlerWithModel.getModel() + expect(model.id).toBe(testModelId) + expect(model.info).toEqual(internationalZAiModels[testModelId]) + expect(model.info.contextWindow).toBe(200_000) + expect(model.info.maxTokens).toBe(131_072) + expect(model.info.supportsReasoningEffort).toEqual(["disable", "medium"]) + expect(model.info.reasoningEffort).toBe("medium") + expect(model.info.preserveReasoning).toBe(true) + expect(model.info.supportsImages).toBe(false) + }) + it("should return GLM-4.5v international model with vision support", () => { const testModelId: InternationalZAiModelId = "glm-4.5v" const handlerWithModel = new ZAiHandler({ @@ -178,6 +196,24 @@ describe("ZAiHandler", () => { expect(model.info.contextWindow).toBe(131_072) }) + it("should return GLM-5.1 China model with thinking support and 128k max output", () => { + const testModelId: MainlandZAiModelId = "glm-5.1" + const handlerWithModel = new ZAiHandler({ + apiModelId: testModelId, + zaiApiKey: "test-zai-api-key", + zaiApiLine: "china_coding", + }) + const model = handlerWithModel.getModel() + expect(model.id).toBe(testModelId) + expect(model.info).toEqual(mainlandZAiModels[testModelId]) + expect(model.info.contextWindow).toBe(204_800) + expect(model.info.maxTokens).toBe(131_072) + expect(model.info.supportsReasoningEffort).toEqual(["disable", "medium"]) + expect(model.info.reasoningEffort).toBe("medium") + expect(model.info.preserveReasoning).toBe(true) + expect(model.info.supportsImages).toBe(false) + }) + it("should return GLM-4.7 China model with thinking support", () => { const testModelId: MainlandZAiModelId = "glm-4.7" const handlerWithModel = new ZAiHandler({