八、中国用户特别提示
📌 本节包含 3 个问题:Q65: API 访问不了 | Q66: WhatsApp 能否使用 | Q67: npm 镜像问题
Q1: API 访问不了怎么办?
说明: OpenAI、Anthropic、Google 的 API 在中国大陆无法直接访问。
解决方案:
bash
# 方案一:使用代理
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
openclaw gateway --port 18789
# 方案二:使用 OpenRouter(一个 Key 用所有模型,通过环境变量设置 Key)
export OPENROUTER_API_KEY="sk-or-xxxxx"
openclaw config set agents.defaults.model "openrouter/openai/gpt-5.2"
# 方案三:使用国产模型(通过 OpenAI 兼容接口或 OpenRouter 接入)
# DeepSeek、Moonshot 等可配置为 OpenAI 兼容提供商:
# 在 ~/.openclaw/openclaw.json 中:
# { "models": { "providers": { "deepseek": { "baseUrl": "https://api.deepseek.com/v1" } } } }
# 然后设置环境变量和模型
openclaw config set agents.defaults.model "deepseek/deepseek-chat"
# 方案四:本地模型(推理阶段可以离线;首次拉取模型通常需要网络)
ollama pull qwen2.5:7b
openclaw config set agents.defaults.model "ollama/qwen2.5:7b"Q2: WhatsApp 在中国能用吗?
说明: WhatsApp 在中国大陆需要代理才能使用。
替代方案:
- Telegram(需要代理,但 Bot API 可以通过代理访问)
- 飞书 / Lark(国内原生支持,OpenClaw 通过扩展支持飞书 Channel)
- 注意:钉钉、微信公众号、个人微信均不受官方支持
bash
# 配置飞书(推荐中国用户)
openclaw channels add feishu
# 按提示配置飞书开放平台的 App ID 和 App SecretQ3: npm 镜像配置后还是装不上
解决方案:
bash
# 清除 npm 缓存
npm cache clean --force
# 确认镜像生效
npm config get registry
# 应该显示 https://registry.npmmirror.com
# 如果还是不行,试试直接下载
# 去 GitHub Releases 页面下载预编译包
# https://github.com/openclaw/openclaw/releases
# 或者用 Docker(镜像可以从国内源拉取)
docker pull openclaw/openclaw:latest