-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: add GLM-4.6 model support to Z.AI provider #8412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,12 +2,24 @@ import type { ModelInfo } from "../model.js" | |||||||||
| import { ZaiApiLine } from "../provider-settings.js" | ||||||||||
|
|
||||||||||
| // Z AI | ||||||||||
| // https://docs.z.ai/guides/llm/glm-4.5 | ||||||||||
| // https://docs.z.ai/guides/llm/glm-4.6 | ||||||||||
| // https://docs.z.ai/guides/overview/pricing | ||||||||||
|
|
||||||||||
| export type InternationalZAiModelId = keyof typeof internationalZAiModels | ||||||||||
| export const internationalZAiDefaultModelId: InternationalZAiModelId = "glm-4.5" | ||||||||||
| export const internationalZAiDefaultModelId: InternationalZAiModelId = "glm-4.6" | ||||||||||
| export const internationalZAiModels = { | ||||||||||
| "glm-4.6": { | ||||||||||
| maxTokens: 98_304, | ||||||||||
| contextWindow: 200_000, | ||||||||||
| supportsImages: false, | ||||||||||
| supportsPromptCache: true, | ||||||||||
| inputPrice: 0.6, | ||||||||||
| outputPrice: 2.2, | ||||||||||
| cacheWritesPrice: 0, | ||||||||||
| cacheReadsPrice: 0.11, | ||||||||||
| description: | ||||||||||
| "GLM-4.6 is Zhipu's latest SOTA models for reasoning, code, and agentsUpgraded across 8 authoritative benchmarks. With a 355B-parameter MoE architecture and 200K context, it surpasses GLM-4.5 in coding, reasoning, search, writing, and agent applications.", | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Typo/grammar. Missing space in 'agentsUpgraded' and plural 'models' should be singular. Add 'window' for clarity.
Suggested change
|
||||||||||
| }, | ||||||||||
| "glm-4.5": { | ||||||||||
| maxTokens: 98_304, | ||||||||||
| contextWindow: 131_072, | ||||||||||
|
|
@@ -18,7 +30,7 @@ export const internationalZAiModels = { | |||||||||
| cacheWritesPrice: 0, | ||||||||||
| cacheReadsPrice: 0.11, | ||||||||||
| description: | ||||||||||
| "GLM-4.5 is Zhipu's latest featured model. Its comprehensive capabilities in reasoning, coding, and agent reach the state-of-the-art (SOTA) level among open-source models, with a context length of up to 128k.", | ||||||||||
| "GLM-4.5 is Zhipu's previous flagship model. Its comprehensive capabilities in reasoning, coding, and agent are excellent among open-source models, with a context length of up to 128k.", | ||||||||||
| }, | ||||||||||
| "glm-4.5-air": { | ||||||||||
| maxTokens: 98_304, | ||||||||||
|
|
@@ -35,8 +47,40 @@ export const internationalZAiModels = { | |||||||||
| } as const satisfies Record<string, ModelInfo> | ||||||||||
|
|
||||||||||
| export type MainlandZAiModelId = keyof typeof mainlandZAiModels | ||||||||||
| export const mainlandZAiDefaultModelId: MainlandZAiModelId = "glm-4.5" | ||||||||||
| export const mainlandZAiDefaultModelId: MainlandZAiModelId = "glm-4.6" | ||||||||||
| export const mainlandZAiModels = { | ||||||||||
| "glm-4.6": { | ||||||||||
| maxTokens: 98_304, | ||||||||||
| contextWindow: 200_000, | ||||||||||
| supportsImages: false, | ||||||||||
| supportsPromptCache: true, | ||||||||||
| inputPrice: 0.29, | ||||||||||
| outputPrice: 1.14, | ||||||||||
| cacheWritesPrice: 0, | ||||||||||
| cacheReadsPrice: 0.057, | ||||||||||
| description: | ||||||||||
| "GLM-4.6 is Zhipu's latest SOTA models for reasoning, code, and agentsUpgraded across 8 authoritative benchmarks. With a 355B-parameter MoE architecture and 200K context, it surpasses GLM-4.5 in coding, reasoning, search, writing, and agent applications.", | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: In the GLM-4.6 description for the Mainland model, 'agentsUpgraded' is missing a separator.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Same copy issue as above.
Suggested change
|
||||||||||
| tiers: [ | ||||||||||
| { | ||||||||||
| contextWindow: 32_000, | ||||||||||
| inputPrice: 0.21, | ||||||||||
| outputPrice: 1.0, | ||||||||||
| cacheReadsPrice: 0.043, | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| contextWindow: 128_000, | ||||||||||
| inputPrice: 0.29, | ||||||||||
| outputPrice: 1.14, | ||||||||||
| cacheReadsPrice: 0.057, | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| contextWindow: Infinity, | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Using Infinity for a tier contextWindow can cause issues in some consumers (JSON serialization, numeric comparisons). Given the model’s max supported context is 200K, use explicit numeric value.
Suggested change
|
||||||||||
| inputPrice: 0.29, | ||||||||||
| outputPrice: 1.14, | ||||||||||
| cacheReadsPrice: 0.057, | ||||||||||
| }, | ||||||||||
| ], | ||||||||||
| }, | ||||||||||
| "glm-4.5": { | ||||||||||
| maxTokens: 98_304, | ||||||||||
| contextWindow: 131_072, | ||||||||||
|
|
@@ -47,7 +91,7 @@ export const mainlandZAiModels = { | |||||||||
| cacheWritesPrice: 0, | ||||||||||
| cacheReadsPrice: 0.057, | ||||||||||
| description: | ||||||||||
| "GLM-4.5 is Zhipu's latest featured model. Its comprehensive capabilities in reasoning, coding, and agent reach the state-of-the-art (SOTA) level among open-source models, with a context length of up to 128k.", | ||||||||||
| "GLM-4.5 is Zhipu's previous flagship model. Its comprehensive capabilities in reasoning, coding, and agent are excellent among open-source models, with a context length of up to 128k.", | ||||||||||
| tiers: [ | ||||||||||
| { | ||||||||||
| contextWindow: 32_000, | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: In the GLM-4.6 description, 'agentsUpgraded' is missing a separator (e.g. a space or punctuation).