Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions packages/types/src/providers/zai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
36 changes: 36 additions & 0 deletions src/api/providers/__tests__/zai.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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({
Expand Down
Loading