Repository navigation
Conversation
- Add 'zai', 'zhipuai', and 'zhipu' to OPENAI_COMPATIBLE_PROVIDERS with standard paas endpoints - Support environment key fallbacks across ZAI_API_KEY, BIGMODEL_API_KEY, and ZHIPUAI_API_KEY - Add 'zai', 'zhipuai', and 'zhipu' to SUPPORTED_NATIVE_PROVIDERS and PROVIDER_ALIASES in LLM - Automatically infer 'zai' provider for bare 'glm-*' model identifiers - Add 8 comprehensive unit tests covering provider configs, env fallbacks, and LLM factory routing
Strix Security ReviewWarning This pull request has 1 commit after the last Strix review ( ✅ No open security findings. PR summary: This PR registers Z.ai and ZhipuAI as native OpenAI-compatible providers (registry entries, provider aliases, and inference of the `zai` provider from bare `glm-*` model names), and adds a `fallback_api_key_envs` mechanism so an API key can be resolved from related Zhipu-family environment variables. It also adds tests covering the new configurations and key fallback chains. Review summaryReviewed the provider registry additions, the alias/native-provider routing entries, the Ruled out (3)
Review 1 on this PR · Reviewed by Strix |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit efd03a8. Configure here.
Add 'bigmodel' to SUPPORTED_NATIVE_PROVIDERS and OPENAI_COMPATIBLE_PROVIDERS with standard paas endpoint and key fallbacks, ensuring provider='bigmodel' routes to native OpenAICompatibleCompletion instead of falling back to LiteLLM. Add unit tests verifying factory and explicit provider routing.

Fixes #8782
Description
This PR adds first-class native OpenAI-compatible provider support for Z.ai and ZhipuAI (
zai,zhipuai,zhipu), enabling modern GLM models (such asglm-5.3-flash,glm-5.3,glm-5v-turbo,glm-4-flash, etc.) to be used natively and reliably in CrewAI agents.Addresses #8782.
Changes
crewai.llms.providers.openai_compatible):zai,zhipuai, andzhipuinOPENAI_COMPATIBLE_PROVIDERSwith their official OpenAI-compatible endpoints (https://api.z.ai/api/paas/v4andhttps://open.bigmodel.cn/api/paas/v4).fallback_api_key_envstoProviderConfigsoOpenAICompatibleCompletioncan automatically fall back acrossZAI_API_KEY,BIGMODEL_API_KEY, andZHIPUAI_API_KEY.crewai.llm):zai,zhipuai,zhipu, andbigmodeltoSUPPORTED_NATIVE_PROVIDERS,PROVIDER_ALIASES, andopenai_compatible_providers.glm-*model strings (e.g.,LLM(model="glm-5.3-flash")).test_openai_compatible.pyvalidating configuration, multi-key fallback chains, and LLM factory instantiation.test_openai_compatible.pypass with zero lint errors (ruff check/ruff formatclean).Note
Low Risk
Additive LLM provider and routing changes with tests; no changes to auth or core agent execution paths beyond new provider selection.
Overview
Adds native OpenAI-compatible routing for Z.ai / ZhipuAI GLM models so agents can use
zai,zhipuai,zhipu, andbigmodelwithout relying on LiteLLM.Provider wiring: New entries in the OpenAI-compatible registry point at
https://api.z.ai/api/paas/v4andhttps://open.bigmodel.cn/api/paas/v4, with env varsZAI_API_KEY,ZHIPUAI_API_KEY, andBIGMODEL_API_KEY.ProviderConfiggainsfallback_api_key_envs, and key resolution tries those alternates when the primary env var is missing (handy across Z.ai vs BigModel naming).LLM factory: The new prefixes are registered in native provider lists and aliases; bare models starting with
glm-orglm_inferzai. Factory and integration tests cover config, key fallback, prefixed models, and explicitprovider=.Reviewed by Cursor Bugbot for commit 11856a9. Bugbot is set up for automated code reviews on this repo. Configure here.