Skip to content

Review with z.ai (GLM)

z.ai's GLM models (from Zhipu AI) are a first-class provider: add a ZAI_API_KEY and pick a model. lgtmaybe reaches them through litellm's native zai/ route, so the international endpoint needs no api_base.

Contents

Get an API Key

Create a key in the z.ai developer console (see the API docs). In your repository, add it as an Actions secret named ZAI_API_KEY (Settings → Secrets and variables → Actions → New repository secret).

GitHub Action

Copy examples/workflows/review-zai.yml to .github/workflows/lgtmaybe.yml. The core step is:

- uses: MattJColes/lgtmaybe@v2
  with:
    provider: zai
    model: glm-4.6
    api_key: ${{ secrets.ZAI_API_KEY }}

The workflow runs on pull_request_target, so the secret is available, but PR code is never checked out: lgtmaybe reads the diff through the API. See Use as a GitHub Action for the full workflow, including who can trigger a review.

Run Locally

export ZAI_API_KEY=...

lgtmaybe review --provider zai --model glm-4.6

You can pass the key with --api-key ... instead of the env var. Either way, the key is never persisted to config.

Choosing the Model

Pass any GLM chat model your key can access, such as glm-4.6, glm-4.7, glm-4.5-air, or a newer glm-5.x. Use the name z.ai's API expects; lgtmaybe adds the zai/ route prefix for you.

China / Coding-Plan Endpoint

The native route targets z.ai's international endpoint. To use the China or coding-plan endpoint instead, point --api-base (or ZAI_API_BASE, or the Action's api_base input) at it:

lgtmaybe review \
  --provider zai \
  --model glm-4.6 \
  --api-base https://open.bigmodel.cn/api/paas/v4

Persist Non-Secret Defaults

Provider and model are not secrets, so they can live in .lgtmaybe.yml. The key stays in the environment.

provider: zai
model: glm-4.6

With that file in place, lgtmaybe review needs no flags. See Configure .lgtmaybe.yml for every setting.