Skip to content

Commit 81c3317

Browse files
committed
feat(zai): add GLM-4.5V vision model (supportsImages, pricing, 16K max output); add tests
1 parent f9053ec commit 81c3317

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

packages/types/src/providers/zai.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ export const internationalZAiModels = {
6666
cacheReadsPrice: 0,
6767
description: "GLM-4.5-Flash is a free, high-speed model excellent for reasoning, coding, and agentic tasks.",
6868
},
69+
"glm-4.5v": {
70+
maxTokens: 16_384,
71+
contextWindow: 131_072,
72+
supportsImages: true,
73+
supportsPromptCache: true,
74+
inputPrice: 0.6,
75+
outputPrice: 1.8,
76+
cacheWritesPrice: 0,
77+
cacheReadsPrice: 0.11,
78+
description:
79+
"GLM-4.5V is Z.AI's multimodal visual reasoning model (image/video/text/file input), optimized for GUI tasks, grounding, and document/video understanding.",
80+
},
6981
"glm-4.6": {
7082
maxTokens: 98_304,
7183
contextWindow: 204_800,
@@ -181,6 +193,18 @@ export const mainlandZAiModels = {
181193
cacheReadsPrice: 0,
182194
description: "GLM-4.5-Flash is a free, high-speed model excellent for reasoning, coding, and agentic tasks.",
183195
},
196+
"glm-4.5v": {
197+
maxTokens: 16_384,
198+
contextWindow: 131_072,
199+
supportsImages: true,
200+
supportsPromptCache: true,
201+
inputPrice: 0.29,
202+
outputPrice: 0.93,
203+
cacheWritesPrice: 0,
204+
cacheReadsPrice: 0.057,
205+
description:
206+
"GLM-4.5V is Z.AI's multimodal visual reasoning model (image/video/text/file input), optimized for GUI tasks, grounding, and document/video understanding.",
207+
},
184208
"glm-4.6": {
185209
maxTokens: 98_304,
186210
contextWindow: 204_800,

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ describe("ZAiHandler", () => {
8484
expect(model.info).toEqual(internationalZAiModels[testModelId])
8585
expect(model.info.contextWindow).toBe(204_800)
8686
})
87+
88+
it("should return GLM-4.5v international model with vision support", () => {
89+
const testModelId: InternationalZAiModelId = "glm-4.5v"
90+
const handlerWithModel = new ZAiHandler({
91+
apiModelId: testModelId,
92+
zaiApiKey: "test-zai-api-key",
93+
zaiApiLine: "international_coding",
94+
})
95+
const model = handlerWithModel.getModel()
96+
expect(model.id).toBe(testModelId)
97+
expect(model.info).toEqual(internationalZAiModels[testModelId])
98+
expect(model.info.supportsImages).toBe(true)
99+
expect(model.info.maxTokens).toBe(16_384)
100+
expect(model.info.contextWindow).toBe(131_072)
101+
})
87102
})
88103

89104
describe("China Z AI", () => {
@@ -134,6 +149,21 @@ describe("ZAiHandler", () => {
134149
expect(model.info).toEqual(mainlandZAiModels[testModelId])
135150
expect(model.info.contextWindow).toBe(204_800)
136151
})
152+
153+
it("should return GLM-4.5v China model with vision support", () => {
154+
const testModelId: MainlandZAiModelId = "glm-4.5v"
155+
const handlerWithModel = new ZAiHandler({
156+
apiModelId: testModelId,
157+
zaiApiKey: "test-zai-api-key",
158+
zaiApiLine: "china_coding",
159+
})
160+
const model = handlerWithModel.getModel()
161+
expect(model.id).toBe(testModelId)
162+
expect(model.info).toEqual(mainlandZAiModels[testModelId])
163+
expect(model.info.supportsImages).toBe(true)
164+
expect(model.info.maxTokens).toBe(16_384)
165+
expect(model.info.contextWindow).toBe(131_072)
166+
})
137167
})
138168

139169
describe("Default behavior", () => {

0 commit comments

Comments
 (0)