Home Tutorials Categories Skills About
ZH EN JA KO
Model Integration

Integrating Zhipu GLM (ChatGLM) Models with OpenClaw

· 12 min read

Zhipu AI and the GLM Model Series

Zhipu AI is an AI company incubated by Tsinghua University's technology team. Its GLM (General Language Model) series is well-regarded in both academia and industry. Built on a proprietary technology stack, GLM models excel at bilingual Chinese-English comprehension, logical reasoning, and knowledge-based Q&A. ChatGLM, the conversation-optimized version, has become one of the most popular open-source large language models in China.

OpenClaw natively supports Zhipu AI as a model provider, and you can integrate the various GLM series models with straightforward configuration.

Obtaining a Zhipu AI API Key

  1. Visit the Zhipu AI Open Platform (open.bigmodel.cn) and register an account.
  2. Complete developer verification.
  3. Create a new key on the API Key Management page in the console.
  4. Save your API key.

Zhipu AI provides free token credits for newly registered users, which can be used for testing and initial evaluation.

Quick Configuration

Use the OpenClaw onboarding tool for quick setup:

openclaw onboard

Select GLM (Zhipu AI) as the provider, enter your API key, and choose the default model variant.

Manual Configuration

Set GLM as the default model in openclaw.json:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "glm/glm-4"
      }
    }
  }
}

Authentication Configuration

{
  "providers": {
    "glm": {
      "auth": [
        {
          "key": "your-zhipu-ai-api-key"
        }
      ]
    }
  }
}

Multi-account configuration:

{
  "providers": {
    "glm": {
      "auth": [
        { "key": "key-A", "profile": "primary-account" },
        { "key": "key-B", "profile": "backup-account" },
        { "key": "key-C", "profile": "peak-hours-backup" }
      ]
    }
  }
}

OpenClaw's multi-account authentication system automatically performs profile rotation. When a key encounters rate limiting or an abnormal response, the system automatically switches to the next available profile and starts a cooldown timer for the failed key. Once the cooldown period ends, the key is automatically restored to an available state.

GLM Model Selection Guide

Zhipu AI offers several models for different use cases:

  • glm/glm-4: The latest flagship model with the strongest overall capabilities, supporting 128K context, ideal for complex tasks.
  • glm/glm-4-plus: An enhanced version with further improvements in reasoning and creative abilities.
  • glm/glm-4-air: A lightweight, high-speed version with lower latency and better cost efficiency, suitable for latency-sensitive scenarios.
  • glm/glm-4-flash: An ultra-fast version with the lowest cost, suitable for simple conversations and high-concurrency calls.
  • glm/glm-4v: A multimodal version with image understanding support.

Choose the appropriate variant based on your specific needs. For everyday conversation scenarios, glm-4-air provides a good balance of performance and cost.

GLM Technical Highlights

GLM models have several noteworthy technical features:

  • Bilingual Capabilities: GLM performs excellently on both Chinese and English tasks, making it suitable for scenarios that require frequent language switching.
  • Tool Calling: GLM-4 supports Function Calling, enabling interaction with external tools and APIs.
  • Long Context: GLM-4 supports a 128K context window, capable of handling long documents and complex multi-turn conversations.
  • Knowledge Freshness: Zhipu AI regularly updates the model's knowledge base to maintain information timeliness.

Configuring Failover

Set up a failover chain for GLM:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "glm/glm-4",
        "fallback": "qwen/qwen-max"
      }
    }
  }
}

Both GLM and Qwen are Chinese-made models with excellent Chinese language capabilities. Using them as fallbacks for each other provides users with a similar experience during service interruptions.

Integration with the OpenClaw Ecosystem

After integrating GLM into OpenClaw, you can leverage OpenClaw's rich feature set to enhance the GLM experience:

  • Multi-Platform Distribution: Connect the GLM model to Discord, Telegram, Slack, and other chat platforms through OpenClaw.
  • Per-Channel Model Switching: Use GLM in specific channels while using different models in others.
  • Unified Management: Manage GLM and all other provider configurations from OpenClaw's unified dashboard.

Notes

  • API Rate Limiting: Zhipu AI has different concurrency limits for free and paid tiers. For high-frequency use cases, configuring multiple keys is recommended.
  • Content Moderation: GLM models comply with Chinese content compliance standards.
  • Model Updates: Zhipu AI regularly updates model versions. Stay informed about official announcements and adjust configurations accordingly.

Testing and Verification

After configuration, send a test message. Try some bilingual Chinese-English tasks to experience GLM's bilingual capabilities. Check the OpenClaw logs to confirm that requests are correctly routed to Zhipu AI.

OpenClaw is a free, open-source personal AI assistant that supports WhatsApp, Telegram, Discord, and many more platforms