feat(models): GLM 5.1/5.2/5.3 via API and via the Claude Code CLI (Z.ai devpack)

Add GLM 5.1, 5.2 and 5.3 to the Z.ai provider (harness + web). Z.ai GLM can
now run two ways:
- plain API (OpenAI-compatible, api.z.ai/api/paas/v4) as before, and
- agentically through the Claude Code CLI pointed at Z.ai's Anthropic-compatible
  endpoint (the Z.ai devpack / cline / zcode setup) when the subscription
  toggle is on — chat_claude_stream injects ANTHROPIC_BASE_URL +
  ANTHROPIC_AUTH_TOKEN from ZAI_API_KEY for the zai provider.

cli_binary_for("zai") -> claude; cli_login_status checks ZAI_API_KEY instead of
probing the Claude login; web verifies the key against z.ai's /models. GLM is
reasoning-heavy so it keeps the larger token ceiling. Covered by a new test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
CyberSecurityUPandClaude Opus 4.8 committed 2026-10-15 20:20:18 -03:00
1 parent a094fedc5c
commit 0aaac20a0d
2 files changed
+65 -8

No files matched your search

+6 -2
View File
@@ -121,8 +121,11 @@ const PROVIDERS = [
models: ['mistral-large-latest', 'codestral-latest'] },
{ key: 'qwen', label: 'Qwen (DashScope)', kind: 'api', envKey: 'DASHSCOPE_API_KEY',
models: ['qwen3.8-max', 'qwen3.8-omni-flash', 'qwen-max', 'qwen2.5-coder-32b-instruct', 'qwq-plus'] },
// Z.ai GLM: always needs a ZAI_API_KEY (so kind:'api' keeps the key field),
// but with the subscription toggle on it runs agentically through the Claude
// Code CLI pointed at Z.ai's Anthropic-compatible endpoint (devpack/cline).
{ key: 'zai', label: 'Z.ai (GLM)', kind: 'api', envKey: 'ZAI_API_KEY',
models: ['glm-5.3', 'glm-5.3-flashx', 'glm-4.6'] },
models: ['glm-5.3', 'glm-5.2', 'glm-5.1', 'glm-5.3-flashx', 'glm-4.6'] },
{ key: 'groq', label: 'Groq', kind: 'api', envKey: 'GROQ_API_KEY',
models: ['llama-3.3-70b-versatile', 'qwen-2.5-coder-32b'] },
{ key: 'together', label: 'Together AI', kind: 'api', envKey: 'TOGETHER_API_KEY',
@@ -163,7 +166,8 @@ function keyProbe(provider, key) {
case 'moonshot': return { url: 'https://api.moonshot.ai/v1/models', headers: bearer };
case 'qwen': return { url: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models', headers: bearer };
case 'nvidia_nim': return { url: 'https://integrate.api.nvidia.com/v1/models', headers: bearer };
default: return null; // opencode, nous, zai, litellm, azure, ollama, llamacpp — not auto-verifiable here
case 'zai': return { url: 'https://api.z.ai/api/paas/v4/models', headers: bearer };
default: return null; // opencode, nous, litellm, azure, ollama, llamacpp — not auto-verifiable here
}
}