feat: add Zhipu Coding Plan provider (domestic China)#78
Merged
Conversation
Adds a new 'zhipu' quota provider for the domestic China Zhipu Coding Plan (bigmodel.cn), mirroring the existing Z.ai (api.z.ai) provider. - New files: src/lib/zhipu.ts, src/lib/zhipu-auth.ts, src/providers/zhipu.ts - Updated: registry.ts, provider-metadata.ts, types.ts, quota-status.ts - Quota API: https://bigmodel.cn/api/monitor/usage/quota/limit - Auth: ZHIPU_API_KEY env var / opencode.jsonc provider config / auth.json - Supports TUI sidebar, toast, and /quota command status report
Contributor
Author
Owner
|
@mengfanbo123 Thanks for the contribution, I'll take a look! |
- Add zhipu entry to provider-metadata catalog test (between zai and nanogpt) - Add zhipu section to quota-status inline snapshot (between zai and synthetic) - Add zhipu auth/query mocks for quota-status tests
Owner
|
@mengfanbo123 Thanks for the contribution |
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.

Summary
Adds a new Zhipu quota provider for the domestic China Zhipu Coding Plan (
bigmodel.cn), mirroring the existing Z.ai provider (api.z.ai).What's new
zhipu— querieshttps://bigmodel.cn/api/monitor/usage/quota/limitZHIPU_API_KEY/ZHIPU_CODING_PLAN_API_KEYenv vars → opencode.jsonc provider config (zhipu,zhipu-coding-plan,glm-coding-plan) → auth.json/quotacommand status reportFiles changed
src/lib/zhipu.tszai.ts)src/lib/zhipu-auth.tszai-auth.ts)src/providers/zhipu.tszai.ts)src/providers/registry.tszhipuProvidersrc/lib/provider-metadata.tssrc/lib/types.tszhipu-coding-plantoAuthDatainterfacesrc/lib/quota-status.ts/quotacommandUsage
Add to
opencode.jsonc:{ "experimental": { "quotaToast": { "enabledProviders": ["zai", "zhipu", "kimi-code"] } } }And configure the provider:
{ "provider": { "zhipu-coding-plan": { "name": "Zhipu Coding Plan", "options": { "apiKey": "{env:ZHIPU_API_KEY}" }, // ...models... } } }Testing
npm run typecheck✅npm run build✅@mingxy/[email protected]and tested in productionWhy separate provider?
Z.ai (international) and Zhipu (domestic China) use different API endpoints and API keys. They serve different user bases and need independent auth resolution. The domestic endpoint is
bigmodel.cn(notapi.z.ai).