feat: add GLM models to Claude provider options#751
feat: add GLM models to Claude provider options#751hyunsir wants to merge 2 commits intositeboon:mainfrom
Conversation
- Add glm-4.7, glm-4-flash, glm-4-plus, glm-4-air to CLAUDE_MODELS - These models work with Anthropic-compatible APIs like ZhipuAI (https://open.bigmodel.cn/api/anthropic) - Users can configure via ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughFour new GLM model variants ( ChangesModel Registry Update
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
shared/modelConstants.js (1)
7-12: ⚡ Quick winUpdate documentation to explain API-compatible third-party models.
The comment describes Claude model formats but doesn't mention that
CLAUDE_MODELSnow includes API-compatible models from other providers (e.g., ZhipuAI GLM models). Adding this context would help future maintainers understand why non-Claude models appear in this registry.📝 Suggested documentation enhancement
/** * Claude (Anthropic) Models * + * Includes both native Claude models and third-party models that are + * compatible with the Anthropic API format (e.g., ZhipuAI GLM models). + * * Note: Claude uses two different formats: * - SDK format ('sonnet', 'opus') - used by the UI and claude-sdk.js * - API format ('claude-sonnet-4.5') - used by slash commands for display */🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@shared/modelConstants.js` around lines 7 - 12, The comment above the Claude model registry lacks mention that CLAUDE_MODELS now contains API-compatible third-party models (not just Anthropic formats); update the block comment near CLAUDE_MODELS in shared/modelConstants.js to state that the registry may include non-Anthropic models (e.g., ZhipuAI GLM) that use the same API-compatible naming, and clarify which entries are SDK-format vs API-format so maintainers understand why non-Claude names appear.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shared/modelConstants.js`:
- Around line 23-26: Remove the invalid model entries "glm-4-flash",
"glm-4-plus", and "glm-4-air" from the model list in shared/modelConstants.js
because they are not supported by ZhipuAI; replace or add the supported
identifiers "glm-5.1" and "glm-5" if you need more options, and update the
existing { value: "glm-4.7", label: "GLM-4.7 (智谱AI)" } entry to use a consistent
English label like "GLM-4.7 (ZhipuAI)" or "GLM-4.7" to avoid mixed-language
labels. Ensure the final array only contains the documented model value strings
("glm-5.1", "glm-5", "glm-4.7") and their matching labels.
---
Nitpick comments:
In `@shared/modelConstants.js`:
- Around line 7-12: The comment above the Claude model registry lacks mention
that CLAUDE_MODELS now contains API-compatible third-party models (not just
Anthropic formats); update the block comment near CLAUDE_MODELS in
shared/modelConstants.js to state that the registry may include non-Anthropic
models (e.g., ZhipuAI GLM) that use the same API-compatible naming, and clarify
which entries are SDK-format vs API-format so maintainers understand why
non-Claude names appear.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e0d00608-8fbb-4e8f-be38-2f8af0aed36b
📒 Files selected for processing (1)
shared/modelConstants.js
| { value: "glm-4.7", label: "GLM-4.7 (智谱AI)" }, | ||
| { value: "glm-4-flash", label: "GLM-4 Flash" }, | ||
| { value: "glm-4-plus", label: "GLM-4 Plus" }, | ||
| { value: "glm-4-air", label: "GLM-4 Air" }, |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
What are the correct model identifiers for ZhipuAI GLM models when using their Anthropic-compatible API at https://open.bigmodel.cn/api/anthropic
💡 Result:
Correct model identifiers (the value of the model field) for ZhipuAI GLM models when calling the Anthropic-compatible API at https://open.bigmodel.cn/api/anthropic are: - glm-5.1 [1] - glm-5 [1] - glm-4.7 [1] These are the GLM model codes shown in ZhipuAI’s Anthropic API compatibility documentation, and the examples for base_url: https://open.bigmodel.cn/api/anthropic use the same model identifiers (e.g., glm-5.1, glm-4.7, glm-5). [1]
Citations:
Remove non-existent model identifiers.
The ZhipuAI Anthropic-compatible API documentation only supports glm-5.1, glm-5, and glm-4.7. The identifiers glm-4-flash, glm-4-plus, and glm-4-air do not exist in ZhipuAI's API and will cause runtime failures when users attempt to use them. Remove lines 24–26 or replace with documented model identifiers.
Additionally, line 23 mixes Chinese characters with English labels; consider using a consistent language approach.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@shared/modelConstants.js` around lines 23 - 26, Remove the invalid model
entries "glm-4-flash", "glm-4-plus", and "glm-4-air" from the model list in
shared/modelConstants.js because they are not supported by ZhipuAI; replace or
add the supported identifiers "glm-5.1" and "glm-5" if you need more options,
and update the existing { value: "glm-4.7", label: "GLM-4.7 (智谱AI)" } entry to
use a consistent English label like "GLM-4.7 (ZhipuAI)" or "GLM-4.7" to avoid
mixed-language labels. Ensure the final array only contains the documented model
value strings ("glm-5.1", "glm-5", "glm-4.7") and their matching labels.
Summary by CodeRabbit