Skip to content

Add Z.AI provider support for GLM-5 - #938

Merged
zmanian merged 1 commit into
nearai:stagingfrom
reidliu41:feat/glm-provider
Mar 12, 2026
Merged

zmanian merged 1 commit into
nearai:stagingfrom
reidliu41:feat/glm-provider

Conversation

@reidliu41

Copy link
Copy Markdown
Contributor

Summary

  • add a minimal zai registry provider using the existing OpenAI-compatible chat completions path
  • configure default Z.AI endpoint, API key env vars, default model, and setup wizard key URL
  • add a config regression test covering bigmodel alias resolution and canonical backend normalization
  • update FEATURE_PARITY.md to mark GLM-5 as supported via the new provider

Value:

  • makes GLM-5 a first-class provider instead of requiring manual openai_compatible setup
  • keeps the implementation low-risk by reusing the existing provider registry and adapter path
  • improves onboarding and discoverability for Z.AI users with no behavioral changes to other providers

Change Type

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • CI/Infrastructure
  • Security
  • Dependencies

Linked Issue

None

Validation

  • cargo fmt
  • cargo clippy --all --benches --tests --examples --all-features
  • Relevant tests pass:
  • Manual testing:

Security Impact

None

Database Impact

None

Blast Radius

Rollback Plan


Review track:

@github-actions github-actions Bot added scope: docs Documentation size: S 10-49 changed lines risk: low Changes to docs, tests, or low-risk modules contributor: experienced 6-19 merged PRs labels Mar 11, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates Z.AI's GLM-5 model as a native provider, streamlining its configuration and usage within the system. By reusing the established OpenAI-compatible chat completions infrastructure, it offers a low-risk implementation that enhances user experience for Z.AI users by making GLM-5 easily discoverable and accessible without requiring manual setup.

Highlights

  • New Provider Integration: Added a new zai registry provider for Z.AI GLM-5, utilizing the existing OpenAI-compatible chat completions path.
  • Configuration Details: Configured default Z.AI endpoint, API key environment variables, default model, and setup wizard key URL.
  • New Test Case: Included a new regression test to ensure correct resolution of the bigmodel alias to the zai provider.
  • Documentation Update: Updated FEATURE_PARITY.md to reflect GLM-5's support through the new Z.AI provider.
Changelog
  • FEATURE_PARITY.md
    • Marked GLM-5 as supported via the new Z.AI provider.
  • providers.json
    • Added a new provider entry for zai, including its ID, bigmodel alias, open_ai_completions protocol, default base URL, API key environment variable (ZAI_API_KEY), default model (glm-5), and setup wizard details.
  • src/config/llm.rs
    • Introduced a new test registry_provider_alias_resolves_zai to validate the correct resolution of the bigmodel alias to the zai provider and its associated configuration.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for the Z.AI provider for GLM-5 models. The changes include updating the feature parity documentation, adding the provider definition to providers.json, and including a new regression test. The implementation is clean and follows existing patterns. I have one suggestion to improve the robustness of the new test case to better guard against future regressions in the provider's default configuration.

Comment thread src/config/llm.rs
Comment on lines +650 to +654
let settings = Settings {
llm_backend: Some("bigmodel".to_string()),
selected_model: Some("glm-5".to_string()),
..Default::default()
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This test is intended to verify the configuration resolution for the new zai provider, including its alias. However, by explicitly setting selected_model to "glm-5", the test doesn't verify that the default_model from providers.json is correctly configured. If the default_model in providers.json were to change or have a typo, this test would still pass, making it less effective as a regression test for the provider's default configuration.

To make the test more robust and ensure it validates the default configuration from the provider definition, I suggest removing the selected_model field. This will cause the configuration resolution to fall back to the default_model specified in providers.json, which is what we want to test for a new provider's default setup.

A similar test, registry_provider_resolves_tinfoil, already follows this pattern.

        let settings = Settings {
            llm_backend: Some("bigmodel".to_string()),
            ..Default::default()
        };

@reidliu41

Copy link
Copy Markdown
Contributor Author

Could you review this when you get a chance? @zmanian

@zmanian zmanian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review: Add Z.AI provider support for GLM-5

Clean, minimal addition. Reuses the existing OpenAI-compatible provider path, which is the right approach.

  • providers.json entry is well-structured with alias (bigmodel), correct protocol, and setup config
  • Test covers alias resolution and canonical backend normalization, following existing test patterns
  • FEATURE_PARITY.md updated accurately
  • Trailing newline fix on providers.json is a nice cleanup

No concerns. LGTM.

  - add a minimal `zai` registry provider using the existing OpenAI-compatible chat completions path
  - configure default Z.AI endpoint, API key env vars, default model, and setup wizard key URL
  - add a config regression test covering `bigmodel` alias resolution and canonical backend normalization
  - update FEATURE_PARITY.md to mark GLM-5 as supported via the new provider

  Value:
  - makes GLM-5 a first-class provider instead of requiring manual openai_compatible setup
  - keeps the implementation low-risk by reusing the existing provider registry and adapter path
  - improves onboarding and discoverability for Z.AI users with no behavioral changes to other providers
@zmanian
zmanian merged commit e2eb340 into nearai:staging Mar 12, 2026
10 checks passed
@ironclaw-ci ironclaw-ci Bot mentioned this pull request Mar 12, 2026
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: experienced 6-19 merged PRs risk: low Changes to docs, tests, or low-risk modules scope: docs Documentation size: S 10-49 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants