OpenClaw, formerly known as ClawdBot, has picked up a lot of attention lately, and after trying it out, it’s easy to see why. It’s a capable tool, and getting it running in a mainland China network environment is fairly straightforward once the basic pieces are in place. Here’s a practical walkthrough using a local Windows setup as the example, along with the steps for linking it to a QQ bot.
What you need first
Before deployment, prepare the following:
- a model API
- hardware with at least 2 CPU cores and 4 GB of RAM
- Linux, macOS, or Windows
- a QQ account
For the large model API, DeepSeek can be used as an example. Its official purchase page is:
https://platform.deepseek.com
The example below uses local deployment on Windows. The process is essentially the same on Linux and macOS; the main difference is the exact configuration path. OpenClaw stores its default config under the user directory on all three major systems.
Install the required environment
Start by installing Node.js. You need version v22.22.0 or newer:
https://nodejs.org/zh-cn/download
You’ll also need Git:
https://git-scm.com/install/windows
Allow PowerShell scripts to run
After installing the environment, system variables do not always refresh immediately. If necessary, restart the computer first. Then open PowerShell as an administrator and run the following command. When prompted, choose A to allow script execution.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Network-related setup for use in China
Set the npm registry mirror:
npm config set registry https://registry.npmmirror.com
Optionally, you can configure a global Git acceleration rule:
git config --global url."https://hub.cmoko.com/https://github.com/".insteadOf https://github.com/
If you want to remove that Git acceleration setting later, use:
git config --global --unset url."https://hub.cmoko.com/https://github.com/".insteadOf
Deploy OpenClaw
1. Install OpenClaw with npm
npm install -g openclaw-cn@latest
2. Initialize the configuration
openclaw-cn setup
3. Open the configuration directory
%USERPROFILE%\.openclaw
4. Edit openclaw.json
Replace the contents with the following configuration and fill in the relevant fields:
{
"gateway": {
"mode": "local",
"bind": "loopback",
"port": 18789,
"auth": {
"mode": "token",
"token": "设置一个token令牌"
}
},
"agents": {
"defaults": {
"model": {
"primary": "openai-compat/填写模型名称"
},
"elevatedDefault": "full",
"compaction": {
"mode": "safeguard"
},
"maxConcurrent": 4
}
},
"models": {
"mode": "merge",
"providers": {
"openai-compat": {
"baseUrl": "https://api.example.com/v1",
"apiKey": "填写你的模型API密钥",
"api": "openai-completions",
"models": [
{
"id": "填写模型名称",
"name": "填写模型名称"
}
]
}
}
},
"tools": {
"exec": {
"backgroundMs": 10000,
"timeoutSec": 1800,
"cleanupMs": 1800000,
"notifyOnExit": true
},
"elevated": {
"enabled": true,
"allowFrom": {}
},
"allow": [
"exec",
"process",
"read",
"write",
"edit",
"web_search",
"web_fetch",
"cron"
]
},
"channels": {}
}
A few fields matter most here:
token: set your own gateway tokenprimary: enter the model name you want to usebaseUrl: point this to your model provider’s API endpointapiKey: add your model API keyidandname: fill in the same model name configured with your provider
Create and connect the QQ bot
Next, create the bot itself. Open the QQ bot OpenClaw section in your browser, then create the bot directly there.
After that, install the bot plugin:
openclaw-cn channels add
Follow the interactive prompt, choose QQ (Community Edition), then enter the AppID and AppSecret when asked.
Start OpenClaw
Once configuration and bot integration are done, start the gateway:
openclaw-cn gateway start
At that point, the deployment is complete and you can start chatting with your QQ bot.
Useful commands
# 查看状态
openclaw-cn gateway status
# 重启
openclaw-cn gateway restart
# 查看日志
openclaw-cn logs
# 停止
openclaw-cn gateway stop
# 卸载
npm uninstall -g openclaw-cn
Notes and common issues
On Linux and macOS, the deployment process is the same in general; the only practical difference is that the configuration file lives under the user directory for that system.
If you want to access the web interface, include the token in the URL:
http://127.0.0.1:18789/?token=你的网关令牌
If something goes wrong, check the logs first:
openclaw-cn logs
Chinese documentation
https://clawd.org.cn/reference/cli-cheatsheet.html