Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Oct 21, 2025

Summary

  • Add missing Z.ai GLM-4.5 variants to the provider.

Added models

  • glm-4.5-x — high-performance, strong reasoning, ultra-fast response (maxTokens 98,304; context 131,072)
  • glm-4.5-airx — lightweight + ultra-fast (aligned to glm-4.5-air pricing/context)
  • glm-4.5-flash — free, fast model for reasoning/coding/agents (pricing set to 0)

Changes

  • Extend model maps for both API lines in packages/types/src/providers/zai.ts
  • Keep canonical API line keys per zaiApiLineSchema (international_coding, china_coding)
  • No UI or schema changes; selection logic auto-picks up new IDs

Validation

  • Unit tests passed: src/api/providers/tests/zai.spec.ts
  • Full Vitest suite passed locally

Release note

  • Z.ai: add GLM-4.5-X, GLM-4.5-AirX, GLM-4.5-Flash

Important

Add GLM-4.5-X, AirX, and Flash models to Z.ai provider and update tests.

  • Models:
    • Add glm-4.5-x, glm-4.5-airx, and glm-4.5-flash to internationalZAiModels and mainlandZAiModels in zai.ts.
    • Update glm-4.6 context window to 200,000 in internationalZAiModels.
  • Tests:
    • Add tests for glm-4.5v model with vision support in zai.spec.ts.
    • Ensure tests cover new models and configurations in zai.spec.ts.
  • Misc:
    • No UI or schema changes; selection logic auto-picks new IDs.

This description was created by Ellipsis for 03a0111. You can customize this summary. It will automatically update as commits are pushed.

Copilot AI review requested due to automatic review settings October 21, 2025 00:29
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Enhancement New feature or request labels Oct 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for three new Z.ai GLM-4.5 model variants: glm-4.5-x, glm-4.5-airx, and glm-4.5-flash. These models are added to both international and China (mainland) product lines with appropriate regional pricing and consistent technical specifications.

Key changes:

  • Added three new model configurations (glm-4.5-x, glm-4.5-airx, glm-4.5-flash) to both international and mainland model maps
  • Configured regional pricing differences between international and China markets
  • All new models share common specs: 98,304 max tokens, 131,072 context window, no image support, with prompt cache support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@roomote
Copy link
Contributor

roomote bot commented Oct 21, 2025

Code Review Summary

Found inconsistencies between international and mainland China model configurations that need to be addressed:

  • glm-4.5-flash has supportsPromptCache: false in international config but true in mainland config (line 62 vs 200)
  • glm-4.5v has maxTokens: 98_304 in international config but 16_384 in mainland config (line 70 vs 208)
  • glm-4.6 has contextWindow: 200_000 in international config but 204_800 in mainland config (line 83 vs 221)
  • glm-4-32b-0414-128k model is present in international config but missing from mainland config (lines 93-103)

These inconsistencies could cause unexpected behavior when users switch between API lines, as the same model ID would have different capabilities.

Follow Along on Roo Code Cloud

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 21, 2025
@hannesrudolph hannesrudolph changed the title feat(zai): add GLM-4.5-X, AirX, Flash Z.ai: add GLM-4.5-X, AirX, Flash (expand model coverage) Oct 21, 2025
@hannesrudolph
Copy link
Collaborator Author

Added GLM-4.5V (vision) to Z.ai provider.

  • International pricing: input $0.6/M, output $1.8/M
  • China pricing: input ¥0.29/M, output ¥0.93/M (kept ratio consistent with docs)
  • ContextWindow 131,072; MaxTokens 16,384; supportsImages: true; supportsPromptCache: true

Files:

Validated with unit tests (Zai provider) and local vitest run.

@hannesrudolph
Copy link
Collaborator Author

Added GLM-4.5V (vision) per docs:

  • supportsImages: true
  • maxTokens: 16,384; contextWindow: 131,072
  • Pricing: International $0.6/M in, $1.8/M out; China ¥0.29/M in, ¥0.93/M out

Code: packages/types/src/providers/zai.ts and tests in src/api/providers/tests/zai.spec.ts.
All Z.ai tests pass.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 21, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Oct 21, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Oct 21, 2025
@cobra91
Copy link

cobra91 commented Oct 21, 2025

@roomote the complete list is
export const internationalZAiModels = {
'glm-4.5': {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 0.6,
outputPrice: 2.2,
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.",
owned_by: 'zai',
},
'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 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 200k.",
owned_by: 'zai',
},
'glm-4.5v': {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 0.6,
outputPrice: 1.8,
cacheWritesPrice: 0,
cacheReadsPrice: 0.11,
description: 'GLM-4.5V is the vision-enabled version of GLM-4.5, providing multimodal capabilities with text and image understanding.',
owned_by: 'zai',
},
'glm-4.5-x': {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 2.2,
outputPrice: 8.9,
cacheWritesPrice: 0,
cacheReadsPrice: 0.45,
description: 'GLM-4.5-X is the extended version with enhanced capabilities and performance for complex tasks.',
owned_by: 'zai',
},
'glm-4.5-air': {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 0.2,
outputPrice: 1.1,
cacheWritesPrice: 0,
cacheReadsPrice: 0.03,
description:
'GLM-4.5-Air is the lightweight version of GLM-4.5. It balances performance and cost-effectiveness, and can flexibly switch to hybrid thinking models.',
owned_by: 'zai',
},
'glm-4.5-airx': {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 1.1,
outputPrice: 4.5,
cacheWritesPrice: 0,
cacheReadsPrice: 0.22,
description: 'GLM-4.5-AirX is the extended version of GLM-4.5-Air with enhanced capabilities.',
owned_by: 'zai',
},
'glm-4-32b-0414-128k': {
maxTokens: 98_304,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.1,
outputPrice: 0.1,
cacheWritesPrice: 0,
cacheReadsPrice: 0,
description: 'GLM-4-32B is a 32 billion parameter model with 128k context length, optimized for efficiency.',
owned_by: 'zai',
},
'glm-4.5-flash': {
maxTokens: 98304,
contextWindow: 131072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
cacheWritesPrice: 0,
cacheReadsPrice: 0,
description: "Zhipu's most advanced free model to date.",
owned_by: 'zai',
},
} as const satisfies Record<string, ModelInfo>;

@roomote
Copy link
Contributor

roomote bot commented Oct 21, 2025

Acknowledged. Thanks for sharing the complete internationalZAiModels list. I will update the model map and tests to include: glm-4.5, glm-4.6, glm-4.5v, glm-4.5-x, glm-4.5-air, glm-4.5-airx, glm-4-32b-0414-128k, and glm-4.5-flash.

- Update pricing, context window, and capabilities for:
  glm-4.5-x, glm-4.5-airx, glm-4.5-flash, glm-4.5v, glm-4.6
- Add glm-4-32b-0414-128k
- Align tests with new model specs
@hannesrudolph hannesrudolph merged commit 34392dd into RooCodeInc:main Oct 21, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 21, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 21, 2025
@cobra91
Copy link

cobra91 commented Oct 21, 2025

@cobra91 Does this PR look good to you now?

yeah i guess it's better now for the coverage but if u can't choose others endpoint, it's useless and not compatible
image

@hannesrudolph
Copy link
Collaborator Author

@cobra91 they don't want us to have both it seems. they will do the juggling on their end.

mini2s added a commit to zgsm-ai/costrict that referenced this pull request Oct 22, 2025