Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 30, 2025

Description

This PR attempts to address Issue #8406 by adding support for the GLM-4.6 model from z.ai (Zhipu AI) with its 200k context window.

Changes

  • Added GLM-4.6 configuration to internationalZAiModels with 200k (204,800 tokens) context window
  • Added GLM-4.6 configuration to mainlandZAiModels with appropriate tiered pricing structure
  • Added comprehensive test coverage for GLM-4.6 model in both international and China API lines

Testing

  • ✅ All existing tests pass
  • ✅ New tests added for GLM-4.6 model verification
  • ✅ TypeScript compilation successful
  • ✅ Linting checks pass

Related Issue

Fixes #8406

Feedback and guidance are welcome!


Important

Adds support for GLM-4.6 model from Zhipu AI with 200k context window and tests for international and China API lines.

  • Behavior:
    • Adds GLM-4.6 model to internationalZAiModels and mainlandZAiModels with a 200k context window.
    • Configures tiered pricing for GLM-4.6 in mainlandZAiModels.
  • Testing:
    • Adds tests for GLM-4.6 in zai.spec.ts for both international and China API lines.
    • Verifies correct model configuration and context window size.
  • Misc:

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

- Add GLM-4.6 configuration to internationalZAiModels with 200k context window
- Add GLM-4.6 configuration to mainlandZAiModels with tiered pricing
- Add test coverage for GLM-4.6 model in both international and China API lines

Fixes #8406
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 30, 2025 09:06
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Enhancement New feature or request labels Sep 30, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Self-review protocol engaged: arguing with myself about GLM-4.6 so future-me doesn't bill at 200k twice.

cacheReadsPrice: 0.057,
},
{
contextWindow: 200_000,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P2] The 200_000 tier duplicates the Infinity tier pricing. Unless the provider bills differently at exactly 200k, this tier appears redundant and can be removed to reduce noise.

"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.",
},
"glm-4.6": {
maxTokens: 98_304,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P3] Please confirm maxTokens for GLM-4.6. With a 204,800 context window, 98,304 mirrors the 4.5 configuration, but it may differ for 4.6 per provider docs.

const model = handlerWithModel.getModel()
expect(model.id).toBe(testModelId)
expect(model.info).toEqual(internationalZAiModels[testModelId])
expect(model.info.contextWindow).toBe(204_800)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P3] Consider asserting pricing and supportsPromptCache for GLM-4.6 (both intl and mainland) to catch future config regressions.

cacheWritesPrice: 0,
cacheReadsPrice: 0.11,
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.",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P3] Optional: add a link to the GLM-4.6 docs/announcement in this description for maintainers to verify context window and pricing quickly.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 30, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 30, 2025
@mrubens mrubens merged commit 9e98d1a into main Sep 30, 2025
23 checks passed
@mrubens mrubens deleted the feat/add-glm-4.6-model branch September 30, 2025 13:26
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 30, 2025
@raxtor
Copy link

raxtor commented Oct 4, 2025

I am not sure if it is fixed, context size is ok, but model never goes over 104k tokens... what is more like 131k context window, than 200k.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] Z.ai provider missing glm-4.6

5 participants