Skip to content

Add Z.ai / GLM 5.2 support as alternative agent backend#92

Merged
valITino merged 1 commit into
mainfrom
claude/vigilant-sagan-un584s
Jun 23, 2026
Merged

Add Z.ai / GLM 5.2 support as alternative agent backend#92
valITino merged 1 commit into
mainfrom
claude/vigilant-sagan-un584s

Conversation

@valITino

Copy link
Copy Markdown
Owner

Summary

Adds support for Z.ai's GLM 5.2 model as an alternative agent backend, following the same pattern as the existing DeepSeek integration. The zai profile reuses the Claude Code image and routes it to Z.ai's Anthropic-compatible API via environment variables, requiring no separate Dockerfile or entrypoint.

Key Changes

  • docker-compose.yml: Added zai service under the zai profile that reuses crhacky/blhackbox:claude-code and configures it to point at Z.ai's API endpoint (https://api.z.ai/api/anthropic) with model mappings for GLM 5.2 and GLM 4.5-air
  • setup.sh: Extended the interactive setup wizard to support Z.ai as a fourth AI client option, with --zai-key flag for non-interactive mode and help text explaining how to obtain a Z.ai API key
  • Makefile: Added zai target to launch the Z.ai agent and updated down, clean, and nuke targets to include the zai profile
  • README.md: Added Tutorial 1c documenting the Z.ai / GLM 5.2 Docker workflow, updated component tables and CLI reference to include the new profile
  • DOCKER.md: Documented the zai service configuration, environment variables, and model mappings
  • .env.example: Added commented example for ZAI_API_KEY
  • tests/test_compose_integrations.py: Added tests verifying the zai service reuses the Claude Code image without a separate Dockerfile and correctly configures the Z.ai API endpoint

Implementation Details

  • The Z.ai integration mirrors the DeepSeek pattern: same Claude Code image, different ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables
  • Model configuration maps Claude's tier names to GLM equivalents: glm-5.2 for Sonnet/Opus, glm-4.5-air for Haiku
  • API timeout increased to 3 seconds (3M ms) to accommodate GLM reasoning latency
  • Optional 1M-token context window support via commented configuration in docker-compose.yml
  • No separate image build or maintenance required — leverages existing Claude Code infrastructure
  • Full MCP wiring and skills system work identically to Claude Code and DeepSeek profiles

https://claude.ai/code/session_01FgsGd8LzjeLEbnVAUv6Szy

Mirror the existing DeepSeek integration to support driving the stack
with Z.ai's GLM 5.2 via its Anthropic-compatible API. The new `zai`
profile reuses the crhacky/blhackbox:claude-code image and points it at
https://api.z.ai/api/anthropic through ANTHROPIC_BASE_URL +
ANTHROPIC_AUTH_TOKEN (from ZAI_API_KEY) -- same MCP wiring, skills, and
entrypoint, only the model backend differs. No new image to build.

- docker-compose.yml: new `zai` service (glm-5.2 / glm-4.5-air tiers,
  API_TIMEOUT_MS, optional commented 1M-context lines)
- Makefile: `make zai` target + zai profile in down/clean/nuke/status
- setup.sh: --zai-key flag, interactive menu option 4, ZAI_API_KEY prompt
- .env.example: ZAI_API_KEY block
- tests: zai compose-wiring tests (mirror the deepseek pair)
- README.md / DOCKER.md: Tutorial 1c + reference-table entries

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgsGd8LzjeLEbnVAUv6Szy
@valITino valITino merged commit 2499353 into main Jun 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants