Skip to content

How to use Z.AI GLM models with OpenClaw

I know how it feels to get stuck in configuration loops. You find a model you want to try, but then you have to figure out the specific API format and authentication method for yet another provider. It takes the fun out of building when the setup is more work than the actual project.

If you want to use GLM models through Z.AI, I recommend following this path. It keeps your keys organized and gets the models running in a few minutes.

  • A Z.AI API key created in the Z.AI console.
  • OpenClaw installed on your system.

You can set this up using the CLI or by updating your config file manually.

Run the onboarding command to link your account. You can do this interactively:

Terminal window
openclaw onboard --auth-choice zai-api-key

Or use the non-interactive version if you have your key ready:

Terminal window
openclaw onboard --zai-api-key "$ZAI_API_KEY"

Add the zai provider to your configuration file. Here is the snippet you need to set GLM as your primary model:

{
env: { ZAI_API_KEY: "sk-..." },
agents: { defaults: { model: { primary: "zai/glm-4.7" } } },
}

If you run into issues, check these common points:

  • Authentication errors: Z.AI uses Bearer auth. Make sure your API key is active in the Z.AI console and correctly copied into your environment settings.
  • Model naming: GLM models must be called with the zai/ prefix. For example, use zai/glm-4.7 to ensure the provider is recognized.

If you still have questions, talk to the AI Setup Assistant.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.