Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/providers/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ function endpoint(provider: SupportedOnboardingProvider, baseUrl?: string): Prov
headers: () => ({}),
};
}
case 'zai': {
const root = baseUrl ? normalizeValidateBaseUrl(baseUrl) : 'https://api.z.ai/api/anthropic';
return {
url: `${root}/v1/models`,
headers: (apiKey) => {
const auth: Record<string, string> = {
'x-api-key': apiKey,
'anthropic-version': '2023-06-01',
};
return withClaudeCodeIdentity('anthropic', baseUrl, auth);
},
};
}
}
}

Expand Down
25 changes: 25 additions & 0 deletions packages/shared/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const SUPPORTED_ONBOARDING_PROVIDERS = [
'openai',
'openrouter',
'ollama',
'zai',
] as const;
export type SupportedOnboardingProvider = (typeof SUPPORTED_ONBOARDING_PROVIDERS)[number];

Expand Down Expand Up @@ -294,6 +295,23 @@ export const BUILTIN_PROVIDERS: Readonly<Record<SupportedOnboardingProvider, Pro
modelDiscoveryMode: 'models',
},
},
zai: {
id: 'zai',
name: 'Z.ai (GLM Coding Plan)',
builtin: true,
wire: 'anthropic',
baseUrl: 'https://api.z.ai/api/anthropic',
defaultModel: 'glm-5.1',
modelsHint: ['glm-5.1', 'glm-5-turbo', 'glm-4.7', 'glm-4.5-air'],
requiresApiKey: true,
capabilities: {
supportsKeyless: false,
supportsModelsEndpoint: false,
supportsReasoning: true,
requiresClaudeCodeIdentity: false,
modelDiscoveryMode: 'static-hint',
},
},
} as const;

// ── ConfigSchema v3 — canonical on-disk shape ────────────────────────────────
Expand Down Expand Up @@ -514,6 +532,13 @@ export const PROVIDER_SHORTLIST: Record<SupportedOnboardingProvider, ProviderSho
primary: [OLLAMA_DEFAULT_MODEL, 'llama3.1', 'qwen2.5'],
defaultPrimary: OLLAMA_DEFAULT_MODEL,
},
zai: {
provider: 'zai',
label: 'Z.ai (GLM Coding Plan)',
keyHelpUrl: 'https://z.ai/manage-apikey/apikey-list',
primary: ['glm-5.1', 'glm-5-turbo', 'glm-4.7', 'glm-4.5-air'],
defaultPrimary: 'glm-5.1',
},
};

export function isSupportedOnboardingProvider(p: string): p is SupportedOnboardingProvider {
Expand Down
7 changes: 7 additions & 0 deletions packages/shared/src/proxy-presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export const PROXY_PRESETS = [
baseUrl: 'http://127.0.0.1:8317',
notes: '',
},
{
id: 'zai-glm',
label: 'Z.ai GLM Coding Plan',
provider: 'anthropic',
baseUrl: 'https://api.z.ai/api/anthropic',
notes: 'GLM-5.1, GLM-5-Turbo, GLM-4.7, GLM-4.5-Air',
},
{
id: 'custom',
label: 'Custom...',
Expand Down
Loading