Add initial ZhipuAI model support to PyMolAI#6
Open
guoshengtong wants to merge 1 commit intoravishar313:masterfrom
Open
Add initial ZhipuAI model support to PyMolAI#6guoshengtong wants to merge 1 commit intoravishar313:masterfrom
guoshengtong wants to merge 1 commit intoravishar313:masterfrom
Conversation
This PR adds direct ZhipuAI (智谱AI) Coding Plan API integration to PyMolAI, enabling users to use GLM models directly via ZhipuAI's OpenAI-compatible endpoint. Features: - ZhipuAIClient for streaming chat with tool calling support - API key storage using system keychain (keyring) - Qt GUI settings dialog for ZhipuAI API key configuration - Model routing logic in runtime.py - Unit tests for ZhipuAI routing New files: - modules/pymol/ai/zhipuai_client.py - modules/pymol/ai/zhipuai_api_key_store.py - modules/pmg_qt/ai_zhipuai_api_key_dialog.py - testing/tests/api/test_ai_zhipuai_routing.py Modified files: - modules/pymol/ai/models.py (added ZhipuAI models) - modules/pymol/ai/runtime.py (added routing logic) - modules/pmg_qt/pymol_qt_gui.py (added menu) - AGENTS.md (updated docs) API Endpoint: https://open.bigmodel.cn/api/coding/paas/v4 Environment Variable: ZHIPUAI_API_KEY Supported Models: - zhipuai/GLM-5 (Latest GLM-5 model) - zhipuai/GLM-5-Turbo (Faster variant) - zhipuai/GLM-4.7, GLM-4.6, GLM-4.5, GLM-4.5-Air Co-authored-by: guoshengtong <xiaotontong@outlook.com>
Owner
|
Hey, Z.ai models are already supported through OpenRouter, do you think adding them separately is worth it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add initial ZhipuAI model support to PyMolAI
This PR adds initial support for ZhipuAI models in PyMolAI through the ZhipuAI Coding Plan API.
The integration uses ZhipuAI's OpenAI-compatible endpoint and allows users to access supported GLM models within the existing PyMolAI workflow.
API endpoint:
https://open.bigmodel.cn/api/coding/paas/v4Environment variable:
ZHIPUAI_API_KEYScope
This PR includes:
ZhipuAIClientimplementation with streaming chat supportkeyring)Supported models
zhipuai/GLM-5zhipuai/GLM-5-Turbozhipuai/GLM-4.7zhipuai/GLM-4.6zhipuai/GLM-4.5zhipuai/GLM-4.5-AirFiles changed
New files
modules/pymol/ai/zhipuai_client.py— ZhipuAI API clientmodules/pymol/ai/zhipuai_api_key_store.py— API key storagemodules/pmg_qt/ai_zhipuai_api_key_dialog.py— Qt settings dialogtesting/tests/api/test_ai_zhipuai_routing.py— Unit testsUpdated files
modules/pymol/ai/models.py— Added ZhipuAI model definitionsmodules/pymol/ai/runtime.py— Added ZhipuAI routing logicmodules/pmg_qt/pymol_qt_gui.py— Added GUI/menu integrationAGENTS.md— Updated documentation.gitignore— Added build artifactsTesting
The following were verified successfully:
keyring/openaiimportsclaude-agent-sdkimportPyQt5importUsage
ZHIPUAI_API_KEYenvironment variable, or save the key through the GUI dialog