Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/add-glm-4-7-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Add GLM-4.7 model support to Z.ai provider
50 changes: 48 additions & 2 deletions packages/types/src/providers/zai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ 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-4.7
// https://docs.z.ai/guides/overview/pricing
// https://bigmodel.cn/pricing

export type InternationalZAiModelId = keyof typeof internationalZAiModels
export const internationalZAiDefaultModelId: InternationalZAiModelId = "glm-4.6"
export const internationalZAiDefaultModelId: InternationalZAiModelId = "glm-4.7"
export const internationalZAiModels = {
"glm-4.5": {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.6,
outputPrice: 2.2,
cacheWritesPrice: 0,
Expand All @@ -30,6 +32,7 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.2,
outputPrice: 1.1,
cacheWritesPrice: 0,
Expand All @@ -43,6 +46,7 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 2.2,
outputPrice: 8.9,
cacheWritesPrice: 0,
Expand All @@ -56,6 +60,7 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 1.1,
outputPrice: 4.5,
cacheWritesPrice: 0,
Expand All @@ -68,6 +73,7 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0,
outputPrice: 0,
cacheWritesPrice: 0,
Expand All @@ -80,6 +86,7 @@ export const internationalZAiModels = {
supportsImages: true,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.6,
outputPrice: 1.8,
cacheWritesPrice: 0,
Expand All @@ -93,6 +100,7 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.6,
outputPrice: 2.2,
cacheWritesPrice: 0,
Expand All @@ -107,6 +115,7 @@ export const internationalZAiModels = {
supportsImages: true,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.3,
outputPrice: 0.9,
cacheWritesPrice: 0,
Expand All @@ -120,6 +129,7 @@ export const internationalZAiModels = {
supportsImages: true,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0,
outputPrice: 0,
cacheWritesPrice: 0,
Expand All @@ -128,12 +138,27 @@ export const internationalZAiModels = {
"GLM-4.6V-Flash is a free, high-speed multimodal model with visual reasoning capabilities, excellent for reasoning, coding, and agentic tasks.",
},
// kilocode_change end
"glm-4.7": {
maxTokens: 98_304,
contextWindow: 200_000,
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.6,
outputPrice: 2.2,
cacheWritesPrice: 0,
cacheReadsPrice: 0.11,
description:
"GLM-4.7 is Zhipu's latest model with enhanced capabilities for reasoning, coding, and agent tasks, building upon the GLM-4.6 foundation with improved performance.",
},
"glm-4-32b-0414-128k": {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.1,
outputPrice: 0.1,
cacheWritesPrice: 0,
Expand All @@ -143,14 +168,15 @@ export const internationalZAiModels = {
} as const satisfies Record<string, ModelInfo>

export type MainlandZAiModelId = keyof typeof mainlandZAiModels
export const mainlandZAiDefaultModelId: MainlandZAiModelId = "glm-4.6"
export const mainlandZAiDefaultModelId: MainlandZAiModelId = "glm-4.7"
export const mainlandZAiModels = {
"glm-4.5": {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.29,
outputPrice: 1.14,
cacheWritesPrice: 0,
Expand All @@ -164,6 +190,7 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.1,
outputPrice: 0.6,
cacheWritesPrice: 0,
Expand All @@ -177,6 +204,7 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.29,
outputPrice: 1.14,
cacheWritesPrice: 0,
Expand All @@ -190,6 +218,7 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.1,
outputPrice: 0.6,
cacheWritesPrice: 0,
Expand All @@ -202,6 +231,7 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0,
outputPrice: 0,
cacheWritesPrice: 0,
Expand All @@ -214,6 +244,7 @@ export const mainlandZAiModels = {
supportsImages: true,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.29,
outputPrice: 0.93,
cacheWritesPrice: 0,
Expand All @@ -227,13 +258,28 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.29,
outputPrice: 1.14,
cacheWritesPrice: 0,
cacheReadsPrice: 0.057,
description:
"GLM-4.6 is Zhipu's newest model with an extended context window of up to 200k tokens, providing enhanced capabilities for processing longer documents and conversations.",
},
"glm-4.7": {
maxTokens: 98_304,
contextWindow: 204_800,
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
inputPrice: 0.29,
outputPrice: 1.14,
cacheWritesPrice: 0,
cacheReadsPrice: 0.057,
description:
"GLM-4.7 is Zhipu's latest model with enhanced capabilities for reasoning, coding, and agent tasks, building upon the GLM-4.6 foundation with improved performance.",
},
} as const satisfies Record<string, ModelInfo>

export const ZAI_DEFAULT_TEMPERATURE = 0.6
Expand Down