Skip to content

Run OpenClaw on GLM-5: Full Setup and Config

Set up OpenClaw with GLM from Z.AI for a flat-rate self-hosted assistant. The config, the coding plan vs pay-per-token choice, key handling, and the gotchas.

MGMCSA Guru Team March 2, 2026 4 min read
OpenClaw configured to use GLM from Z.AI as its model backend

If DeepSeek is the cheapest way to give OpenClaw a brain, GLM is the most predictable. Z.AI’s GLM models come with a flat monthly coding plan, which means an always-on assistant costs the same whether it has a quiet week or a busy one. For anyone who’d rather not watch a token meter, that fixed cost is the whole appeal.

This guide sets up OpenClaw with GLM: the config, the plan-versus-pay-per-token decision, key handling, and the usage caps worth knowing about. It assumes OpenClaw is installed — if not, see the Windows and WSL install guide first.

Why GLM for OpenClaw

The reason to pick GLM over a pure pay-per-use model is billing. A flat coding plan turns a variable, slightly nerve-wracking cost into a line item you forget about. That matters more with OpenClaw than with a chat tool, because an assistant on a schedule works in the background — and on a flat plan, background work doesn’t move the bill.

GLM vs DeepSeek for OpenClaw

GLM (coding plan)
Billing Flat monthly subscription
Best for Heavy, daily, always-on use
Cost certainty Fixed
Caps Rolling-window usage limits

If your use is light or unpredictable, DeepSeek is probably cheaper. If you lean on OpenClaw all day, GLM’s plan usually wins.

Step 1: get a GLM key and pick a billing model

Sign up with Z.AI, decide between the coding plan and pay-per-token, and generate an API key. Note the base URL and current model names from the Z.AI developer docs. The plan-versus-token choice is worth a moment — estimate how much you’ll actually run OpenClaw before committing, since the plan only pays off above a certain volume.

Step 2: store the key in an environment variable

export GLM_API_KEY="your-z-ai-key"

Add it to your shell profile (~/.bashrc or ~/.zshrc) so it survives new sessions. As always, keep it out of any config file you might share.

Step 3: configure OpenClaw to use GLM

Set GLM as the model provider in OpenClaw’s config, using Z.AI’s base URL and a GLM model name, with the key pulled from the environment. Config shapes change between versions, so confirm against the OpenClaw repo; the values you’re providing stay the same:

{
  "model": {
    "provider": "openai-compatible",
    "base_url": "https://api.z.ai/api/paas/v4",
    "api_key_env": "GLM_API_KEY",
    "model": "glm-5"
  }
}

Confirm the exact base URL and model name in Z.AI’s docs — those are the two values most likely to differ from this example. Everything else is OpenClaw’s standard provider setup.

Step 4: test it

Start OpenClaw and hand it a task that uses a capability, not just chat:

Read the files in this folder and tell me which ones changed most recently.

A sensible answer means GLM is connected and the assistant can act. If the model talks but can’t reach files, the model is fine and you’re looking at a skill or permission, not GLM.

OpenClaw + GLM checklist

  • Z.AI account created; coding plan vs pay-per-token decided
  • API key generated and set as an environment variable
  • OpenClaw provider set to Z.AI's base URL with a GLM model
  • Per-window usage cap checked if you're on the plan
  • Tested with a task that touches files

When GLM is the right call

Reach for GLM when predictability matters more than squeezing the last cent. A flat plan suits someone who runs OpenClaw as a daily driver — scheduled jobs, frequent tasks, an assistant they actually lean on. If instead you fire it up occasionally, the plan’s monthly cost is dead weight and DeepSeek’s pay-per-use is the better fit.

Wrapping up

Setting OpenClaw up on GLM is the same short config as any provider — base URL, key from an environment variable, model name — with one extra decision up front: the coding plan versus pay-per-token. Choose the plan if you run OpenClaw hard every day and want a fixed cost, and mind the rolling-window cap so a busy day doesn’t surprise you.

For the alternatives, compare against DeepSeek, or skip API costs entirely with a local Ollama setup.

Frequently asked questions

Why use GLM with OpenClaw instead of DeepSeek?

Billing model. GLM from Z.AI offers a flat monthly coding plan, which is predictable and often cheaper than pay-per-token if you run OpenClaw heavily every day. DeepSeek is pure pay-per-use, better for lighter or bursty use. Pick GLM when you want a fixed monthly cost.

Is GLM compatible with OpenClaw out of the box?

Yes. GLM exposes an API that OpenClaw can use as a model provider — you set the base URL, key, and model. Z.AI's developer docs list the current endpoint and model names. No proxy is required for the standard setup.

What's the difference between the GLM coding plan and pay-per-token?

The coding plan is a flat monthly subscription with usage caps in rolling windows; pay-per-token bills you for exactly what you use. Heavy daily use usually comes out cheaper on the plan, while light use is cheaper pay-per-token. Check Z.AI's pricing page for current limits.

Where do I store the GLM API key?

In an environment variable, referenced from OpenClaw's config rather than written into it. That keeps the key out of files you might share or commit. An always-on assistant holds its key for a long time, so handle it carefully.

Do GLM coding plans have usage limits?

Yes, flat plans typically cap usage in rolling windows, similar to other coding subscriptions. For an always-on assistant that loops on tasks, check the per-window quota, not just the monthly price, so a busy day doesn't hit the cap unexpectedly.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.