Skip to main content

OpenClaw接入平台API Key

本教程将详细指导你如何将OpenClaw接入阿里云百炼平台,包括获取API Key、配置模型等完整步骤。

选择配置方式

根据你的访问方式,选择下方对应的配置标签页:

  • 本地配置:直接在设备本地浏览器访问,无需配置SSH隧道和网关令牌
  • 远程配置:通过Windows浏览器远程访问,需要配置SSH隧道和网关令牌

一、阿里云百炼平台

1.1 登录阿里云

访问阿里云官网:阿里云-计算,为了无法计算的价值

阿里云首页

使用以下任一方式登录:

  • 阿里云账号
  • 支付宝
  • 钉钉

登录方式

1.2 购买Coding Plan

进入阿里百炼控制台,购买Coding Plan:

访问地址:大模型服务平台百炼控制台

购买Coding Plan

1.3 获取API Key

复制并保存你的API Key,后续配置需要使用。

获取API Key

1.4 参考文档

参考阿里云百炼平台文档接入OpenClaw:

大模型服务平台百炼控制台文档

参考文档


二、访问OpenClaw界面

本地浏览器访问

直接在设备本地浏览器中访问OpenClaw界面:

http://localhost:18789

无需配置SSH隧道和网关令牌,直接跳到 配置openclaw.json 章节。


三、配置网关令牌

无需配置

本地浏览器访问无需配置网关令牌,直接跳过此章节,进入 配置openclaw.json


四、配置openclaw.json

参考阿里云百炼文档,在Web UI的左侧菜单栏中选择 配置 > All Settings > RAW

4.1 配置步骤

  1. 复制以下内容到 Raw JSONS 输入框,替换已有内容
  2. YOUR_API_KEY 替换为Coding Plan专属API Key
  3. 单击右上角 Save 保存,然后单击 Update 使配置生效
{
"models": {
"mode": "merge",
"providers": {
"bailian": {
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5-plus",
"name": "qwen3.5-plus",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 1000000,
"maxTokens": 65536
},
{
"id": "qwen3-max-2026-01-23",
"name": "qwen3-max-2026-01-23",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 262144,
"maxTokens": 65536
},
{
"id": "qwen3-coder-next",
"name": "qwen3-coder-next",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 262144,
"maxTokens": 65536
},
{
"id": "qwen3-coder-plus",
"name": "qwen3-coder-plus",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 1000000,
"maxTokens": 65536
},
{
"id": "MiniMax-M2.5",
"name": "MiniMax-M2.5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 196608,
"maxTokens": 32768
},
{
"id": "glm-5",
"name": "glm-5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 202752,
"maxTokens": 16384
},
{
"id": "glm-4.7",
"name": "glm-4.7",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 202752,
"maxTokens": 16384
},
{
"id": "kimi-k2.5",
"name": "kimi-k2.5",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 262144,
"maxTokens": 32768
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "bailian/qwen3.5-plus"
},
"models": {
"bailian/qwen3.5-plus": {},
"bailian/qwen3-max-2026-01-23": {},
"bailian/qwen3-coder-next": {},
"bailian/qwen3-coder-plus": {},
"bailian/MiniMax-M2.5": {},
"bailian/glm-5": {},
"bailian/glm-4.7": {},
"bailian/kimi-k2.5": {}
}
}
},
"gateway": {
"mode": "local"
}
}

填入位置如下:

配置位置

最终配置如下:

最终配置


五、重新配置网关令牌

无需配置

本地浏览器访问无需重新配置网关令牌,直接刷新页面即可。


六、验证配置

最后,右上角健康情况显示正常,你就可以在聊天框与OpenClaw开始聊天了!

验证配置


常见问题

Q: 如何查看我的设备IP地址?

A: 在设备终端执行 ifconfigip addr 命令查看。

Q: 网关令牌忘记了怎么办?

A: 重新执行 cat ~/.openclaw/openclaw.json 查看。

Q: 配置后无法连接怎么办?

A: 检查API Key是否正确,网络连接是否正常,以及网关令牌是否已更新。