Skip to content

Commit daa4eb9

Browse files
author
HEXA_E
committed
feat: add Z.ai GLM Coding Plan as built-in provider
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.
1 parent b94d715 commit daa4eb9

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

packages/shared/src/config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const SUPPORTED_ONBOARDING_PROVIDERS = [
2121
'openai',
2222
'openrouter',
2323
'ollama',
24+
'zai',
2425
] as const;
2526
export type SupportedOnboardingProvider = (typeof SUPPORTED_ONBOARDING_PROVIDERS)[number];
2627

@@ -294,6 +295,23 @@ export const BUILTIN_PROVIDERS: Readonly<Record<SupportedOnboardingProvider, Pro
294295
modelDiscoveryMode: 'models',
295296
},
296297
},
298+
zai: {
299+
id: 'zai',
300+
name: 'Z.ai (GLM Coding Plan)',
301+
builtin: true,
302+
wire: 'anthropic',
303+
baseUrl: 'https://api.z.ai/api/anthropic',
304+
defaultModel: 'glm-5.1',
305+
modelsHint: ['glm-5.1', 'glm-5-turbo', 'glm-4.7', 'glm-4.5-air'],
306+
requiresApiKey: true,
307+
capabilities: {
308+
supportsKeyless: false,
309+
supportsModelsEndpoint: false,
310+
supportsReasoning: true,
311+
requiresClaudeCodeIdentity: false,
312+
modelDiscoveryMode: 'static-hint',
313+
},
314+
},
297315
} as const;
298316

299317
// ── ConfigSchema v3 — canonical on-disk shape ────────────────────────────────
@@ -514,6 +532,13 @@ export const PROVIDER_SHORTLIST: Record<SupportedOnboardingProvider, ProviderSho
514532
primary: [OLLAMA_DEFAULT_MODEL, 'llama3.1', 'qwen2.5'],
515533
defaultPrimary: OLLAMA_DEFAULT_MODEL,
516534
},
535+
zai: {
536+
provider: 'zai',
537+
label: 'Z.ai (GLM Coding Plan)',
538+
keyHelpUrl: 'https://z.ai/manage-apikey/apikey-list',
539+
primary: ['glm-5.1', 'glm-5-turbo', 'glm-4.7', 'glm-4.5-air'],
540+
defaultPrimary: 'glm-5.1',
541+
},
517542
};
518543

519544
export function isSupportedOnboardingProvider(p: string): p is SupportedOnboardingProvider {

packages/shared/src/proxy-presets.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ export const PROXY_PRESETS = [
5959
baseUrl: 'http://127.0.0.1:8317',
6060
notes: '',
6161
},
62+
{
63+
id: 'zai-glm',
64+
label: 'Z.ai GLM Coding Plan',
65+
provider: 'anthropic',
66+
baseUrl: 'https://api.z.ai/api/anthropic',
67+
notes: 'GLM-5.1, GLM-5-Turbo, GLM-4.7, GLM-4.5-Air',
68+
},
6269
{
6370
id: 'custom',
6471
label: 'Custom...',

0 commit comments

Comments
 (0)