I recently attempted to migrate a Claude Code GitHub Action to work with the GLM Coding Plan by Z.ai. While Z.ai's official guide shows using environment variables, the GitHub Action requires a slightly different approach.
Minimal Working Configuration
Here's the essential part of the .github/workflows/claude.yml
file:
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
env:
NODE_VERSION: '22.x'
ANTHROPIC_BASE_URL: 'https://api.z.ai/api/anthropic'
with:
anthropic_api_key: ${{ secrets.ZHIPU_API_KEY }}
Key Differences from Z.ai's Official Guide
For the Claude Code CLI, Z.ai's documentation shows:
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY
However, for the GitHub Action, you need to:
- Set
ANTHROPIC_BASE_URL
as an environment variable - Pass the API key via the
anthropic_api_key
parameter instead ofANTHROPIC_AUTH_TOKEN
Setup Steps
- Add the workflow file to
.github/workflows/claude.yml
- Create a
ZHIPU_API_KEY
secret in your GitHub repo settings (naming it this way helps avoid accidentally using the Claude API with the Z.ai API key) - Comment
@claude
on any issue or PR to trigger the action
That's it! Claude Code will now respond to your mentions using the GLM Coding Plan API endpoint.