Use this workflow to run Claude Code GitHub Actions with Z.ai GLM models.
This setup is intended for the GLM coding plan rather than a normal usage-based API setup. The practical reason is cost control: the coding plan gives fixed pricing with a defined quota, which can be easier to reason about than per-token API billing.
If you want to try the GLM coding plan, you can use this referral link: https://z.ai/subscribe?ic=1NYDIDBPNE
The workflow in .github/workflows/glm.yml listens for @claude mentions on:
- issue comments
- pull request review comments
- pull request reviews
- issues
When a matching event arrives, GitHub Actions runs Claude Code with these Z.ai-backed model settings:
ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropicANTHROPIC_DEFAULT_OPUS_MODEL=glm-5.1ANTHROPIC_DEFAULT_SONNET_MODEL=glm-5-turbo
- Copy .github/workflows/glm.yml into your GitHub repository.
- Open your GitHub repository settings.
- Go to
Settings -> Secrets and variables -> Actions. - Add a new repository secret named
ZAI_API_KEY. - Paste your Z.ai API key as the secret value.
- In the workflow file, keep
ANTHROPIC_BASE_URLset tohttps://api.z.ai/api/anthropic. - Commit the workflow file to your repository.
- Trigger the workflow by mentioning
@claudein an issue or supported review event.
The screenshot below shows the correct GitHub page for adding ZAI_API_KEY. The Z.ai URL belongs in the workflow file, not in GitHub Secrets:
