6.6 KiB
🤖 OpenClaw x Z.AI Integration Guide
A professional setup guide for OpenClaw with Z.AI (GLM 4.7) | Powered by Z.AI
📄 Table of Contents
- Overview
- Quick Start
- Prerequisites
- Installation & Setup
- Configuration
- Testing
- Next Steps
- Troubleshooting
- Contributing
- License
🌟 Overview
This guide provides a structured walkthrough for setting up OpenClaw with Z.AI (GLM 4.7).
⚠️ Security Notice: This installation method requires executing a remote script directly from a URL. This is a known security risk (
curl to bash/cmd). Only proceed if you explicitly trust the source.
🎉 Features
- 🤗 AI-powered Discord bot integration
- 📾 Real-time model configuration
- 🔐 Customizable authentication
- 🕺 Advanced network settings
- 🚫 Message content filtering
⚡ Quick Start
Click to expand quick start guide
# 1. Open Command Line
# Windows: Win + R, type 'cmd', hit Enter
# 2. Copy and paste the installation command:
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
# 3. Follow the prompts in the console
# 4. Test the bot in Discord:
@OpenClaw who r u
📝 Prerequisites
Before you begin, ensure you have:
- Discord Server - Where you can manage roles and permissions
- Discord Application - Created in Discord Developer Portal
- Bot Token - Generated from your Discord application
- Administrator Access - On your target server
- Z.AI API Key - Available from Z.AI Console
- Windows/Linux/Mac - With command line access
🛠️ Installation & Setup
Phase 1: Core Installation
Step 1: Open Command Line
On Windows:
Win + R # Open Run dialog
type: cmd # Type command
Press: Enter # Execute
On macOS/Linux:
Open Terminal
Step 2: Execute the Bootstrap Script
👋 Tip: This command downloads and runs the installer immediately.
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
What this does:
- ⬇️ Downloads the installer
- ▶️ Runs it automatically
- 🗑️ Cleans up after itself
Step 3: Accept the Installation
The system will warn you that this is "powerful and inherently risky."
- Type
**Yes**to continue - Press
Enter
Step 4: Network Configuration
You'll be prompted for network settings:
**Port:** 18789
**Bind:** Loopback (127.0.0.1)
**Tailscale:** Off
📌 Note: You can modify these settings later during the "Gateway port" setup step.
Phase 2: Model Configuration (The Brain)
Step 1: Select Provider
When prompted for the Model/Auth provider, select:
**Z.AI (GLM 4.7)**
from the available list.
Step 2: Authenticate
Select Auth Method:
**API Key** (recommended for initial setup)
Enter API Key:
Paste your Z.AI API Key when prompted
Step 3: Confirm Configuration
The system will confirm:
Model configured to 'zai/glm-4.7'
Phase 3: Discord Bot Setup (The Body)
Step 1: Open Discord Console
Launch Discord and navigate to:
Your Server → Settings → Integrations → Bots
Step 2: Copy Bot Token
- Click on OpenClaw bot
- Click "Copy Token" (appears when you hover)
- Keep this secure!
⚠️ Security Alert: Never share your bot token publicly. Treat it like a password!
Step 3: Paste Token in Console
Return to your command prompt and paste the token when requested.
Step 4: Channel Configuration
Specify which channels the bot can access:
Format: */openclaw, [ChannelID]
Example:
*/openclaw, 1234567890
📊 Tip: Right-click the channel to "Copy Channel ID"
🔍 Testing
Test the Connection
- Go to your configured Discord channel
- Mention the bot:
@OpenClaw who r u - Expected Response: The bot should reply, acknowledging it just came online and asking for a name and personality
🚀 Next Steps
After successful installation, you can:
🌈 Customize your bot's personality and configure additional features as needed.
🚫 Troubleshooting
Common Issues
If you encounter problems:
- 🔍 Verify your API key - Ensure it's correctly entered
- ✅ Check Discord permissions - Confirm all required permissions are granted
- 🌐 Verify port accessibility - Ensure port 18789 is not blocked by firewall
- 📂 Enable Message Content Intent - Required for full functionality in Discord
🤝 Contributing
Feel free to submit issues or pull requests to improve this guide.
⚠️ License & Security Notice
Critical Security Information
🚨 SECURITY CRITICAL: Do NOT use the default port (18789).
Many hosts deploy OpenClaw on a VPS with the default port and zero additional security. The Risk: If you leave port 18789 open on a public VPS, you are effectively inviting hackers to hijack your bot interface.
Solution
Change the port during the "Gateway port" setup step to something random (e.g., 45912) and ensure your firewall only allows traffic from trusted IPs (or use a VPN/Tailscale).
For More Info
See the LICENSE file for licensing information.
Credit: cobrax91310 on Discord | Z.AI Community
Made with ❤️ for the Discord Bot community