Using Claude Code GitHub Action with GLM Coding Plan by Z.ai

1 min readby Patrick Miller

How to configure Claude Code GitHub Action to work with Z.ai GLM Coding Plan API, including the minimal working configuration and key differences from the official guide.

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:

  1. Set ANTHROPIC_BASE_URL as an environment variable
  2. Pass the API key via the anthropic_api_key parameter instead of ANTHROPIC_AUTH_TOKEN

Setup Steps

  1. Add the workflow file to .github/workflows/claude.yml
  2. 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)
  3. 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.