Review with z.ai (GLM)¶
z.ai's GLM models (GLM-4.6 and friends, 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 — no api_base needed for the
international endpoint.
Contents¶
- Get an API key
- GitHub Action
- Run locally
- Choosing the model
- China / coding-plan endpoint
- Persist non-secret defaults
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@v1
with:
provider: zai
model: glm-4.6
api_key: ${{ secrets.ZAI_API_KEY }}
That review runs on pull_request_target, so the secret is available while PR
code is never checked out. lgtmaybe only reads the diff via 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 inline with --api-key ... instead of the env var. The key
is read from the environment or the flag and is never persisted to config.
Choosing the model¶
Pass any GLM chat model your key can access — e.g. glm-4.6, glm-4.7,
glm-4.5-air, or a newer glm-5.x. Use the model name as z.ai's API expects it
(litellm prefixes the zai/ route 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: zai
model: glm-4.6
With that file in place, lgtmaybe review needs no flags. See
Configure .lgtmaybe.yml for every knob.