feat: add Z.ai GLM Coding Plan as built-in provider#378
Conversation
There was a problem hiding this comment.
Review mode: initial
Findings
-
[Minor] Missing changeset for user-visible provider addition
Adding a new built-in provider (Z.ai GLM) is a user-visible change. According to the project conventions, user-visible changes require a changeset (pnpm changeset). The PR checklist includes this checkbox but it appears unchecked. Please add a changeset describing the new provider.
Suggested fix:pnpm changeset # Describe: "feat: add Z.ai (GLM Coding Plan) as built-in provider" -
[Minor] No test coverage for new provider configuration
The project requires at least one Vitest test for new features perCLAUDE.md. While the existing built-in providers may lack tests, adding a test for the new provider entries would improve confidence. Consider adding a test that validates the shape of thezaientry inBUILTIN_PROVIDERS,PROVIDER_SHORTLIST, andSUPPORTED_ONBOARDING_PROVIDERS.
Suggested fix: Add a test inpackages/shared/similar to existing config tests, e.g.:test('zai provider config is well-formed', () => { const zai = BUILTIN_PROVIDERS.zai; expect(zai.wire).toBe('anthropic'); expect(zai.baseUrl).toBe('https://api.z.ai/api/anthropic'); expect(zai.defaultModel).toBe('glm-5.1'); });
Summary
- The PR correctly adds Z.ai (GLM Coding Plan) as a built-in provider, following the established patterns for
SUPPORTED_ONBOARDING_PROVIDERS,BUILTIN_PROVIDERS,PROVIDER_SHORTLIST, andPROXY_PRESETS. - No silent fallbacks, no hardcoded UI values, no direct SDK imports, no regressions.
- Two minor issues: missing changeset and no test coverage. These should be addressed before merging, but do not block evaluation of direction.
Testing
- Not added for this change. The PR body reports all existing tests pass. No new tests were written for the provider config constants.
Open-CoDesign Bot
Add native support for Z.ai's GLM Coding Plan subscription service, enabling users to use GLM-5.1, GLM-5-Turbo, GLM-4.7, and GLM-4.5-Air models directly from the onboarding UI. Changes: - Add 'zai' to SUPPORTED_ONBOARDING_PROVIDERS - Add zai entry to BUILTIN_PROVIDERS (wire: anthropic) - Add zai entry to PROVIDER_SHORTLIST with key help URL - Add zai-glm preset to PROXY_PRESETS Z.ai uses an Anthropic-compatible API endpoint (https://api.z.ai/api/anthropic) designed for agentic coding tools, matching the same integration pattern used by Claude Code.
daa4eb9 to
5b501a1
Compare
|
Update: Fixed pre-existing TS error in validate.ts by adding case for zai provider in endpoint() switch. All 1366 tests pass, TypeScript compilation clean. |
There was a problem hiding this comment.
Review mode: follow-up after new commits
Findings
No new issues introduced by the latest commit (same diff as previous review).
Residual Observations (from prior review)
- Missing changeset for user-visible provider addition — The PR still lacks a changeset. Run
pnpm changesetand describe the new provider. - No test coverage for new provider configuration — The PR does not include Vitest tests for the
zaiprovider configuration constants.
Both are Minor items from the initial review and remain outstanding. They should be addressed before merging.
Summary
The PR correctly adds Z.ai (GLM Coding Plan) as a built-in provider following existing patterns. The code is well-structured and consistent with the project's provider registration conventions. No regressions, no security concerns, no silent fallbacks. The two minor prior findings have not been resolved in this commit.
Open-CoDesign Bot
There was a problem hiding this comment.
Review mode: follow-up after new commits
Findings
- No new issues introduced. The two prior minor findings (missing changeset and missing test coverage) are now resolved.
.changeset/add-zai-glm-provider.mdadded ✅packages/shared/src/config.test.tsincludesdescribe('zai builtin provider', ...)with 5 tests covering the provider entry, capabilities, onboarding inclusion, URL detection, and config v3 parsing ✅
Summary
- All prior findings addressed. Code is consistent with existing provider registration patterns (Ollama, Anthropic, etc.), no regressions, no security concerns, no silent fallbacks.
- The change adds Z.ai as a built-in provider with limited scope:
config.ts(BUILTIN_PROVIDERS, PROVIDER_SHORTLIST),validate.ts(endpoint for validation ping), andproxy-presets.ts(preset entry). No runtime behavior changes beyond what the existing anthropic wire handles. - PR ready to merge.
Open-CoDesign Bot
|
Addressed both review findings:
Pre-push hook (typecheck + lint + test) passes cleanly. |
Summary
Add native support for Z.ai GLM Coding Plan as a built-in provider, enabling users to use GLM-5.1, GLM-5-Turbo, GLM-4.7, and GLM-4.5-Air models directly from the onboarding UI.
Changes
packages/shared/src/config.tszaitoSUPPORTED_ONBOARDING_PROVIDERSzaientry toBUILTIN_PROVIDERSwith:wire: "anthropic"— Z.ai provides an Anthropic-compatible API endpointbaseUrl: "https://api.z.ai/api/anthropic"— official Coding Plan endpointdefaultModel: "glm-5.1"— flagship long-horizon coding modelmodelsHint: ["glm-5.1", "glm-5-turbo", "glm-4.7", "glm-4.5-air"]capabilities: { supportsReasoning: true, modelDiscoveryMode: "static-hint" }zaientry toPROVIDER_SHORTLISTwith key management URLpackages/shared/src/proxy-presets.tszai-glmpreset toPROXY_PRESETSTechnical Details
anthropic— Z.ai provides a fully Anthropic-compatible endpoint athttps://api.z.ai/api/anthropic, the same integration used by Claude Code, Cursor, and other agentic coding toolsstatic-hintmode (4 models) since the Anthropic-compatible endpoint may not expose a/v1/modelsroutethinking.type: "enabled"), compatible with the Anthropic wire reasoning flowpackages/providers/src/index.ts— the existing anthropic wire handling works correctly with Z.ai endpointTesting
@open-codesign/sharedpackages/providers/src/validate.ts:32causes the pre-push hook to fail (unrelated to this PR)References