在OpenClaw中配置和使用Coding Plan的详细步骤

  发布时间:2026-03-04 16:54:45   作者:hhzz   我要评论
OpenClaw (原名Moltbot/Clawdbot )是一个开源的个人 AI 助手平台,支持通过多种消息渠道与 AI 交互,通过配置可接入阿里云百炼的Coding Plan模型,本文给大家详细介绍了如何在OpenClaw中配置和使用Coding Plan,需要的朋友可以参考下

OpenClaw (原名Moltbot/Clawdbot )是一个开源的个人 AI 助手平台,支持通过多种消息渠道与 AI 交互。通过配置可接入阿里云百炼的Coding Plan模型。

接入OpenClaw需要修改配置文件~/.openclaw/openclaw.json 中的模型提供商、默认模型和可用模型列表等信息。

1,安装 OpenClaw

  1. 安装或更新 Node.js(v22.0 或更高版本)。
  2. 执行以下命令开始安装。
    macOS/Linux系统
  1. 安装结束后会自动出现提示信息,请根据提示信息完成 OpenClaw 配置,参考配置如下:
配置项配置内容
I understand this is powerful and inherently risky. Continue?选择 “Yes”
Onboarding mode选择 “QuickStart”
Model/auth provider选择 “Skip for now”,后续可以配置
Filter models by provider选择 “All providers”
Default model使用默认配置
Select channel (QuickStart)选择 “Skip for now”,后续可以配置
Configure skills now? (recommended)选择 “No”,后续可以配置。
Enable hooks?按空格键选中选项,按回车键进入下一步。
How do you want to hatch your bot?选择 “Hatch in TUI”。

2,在 OpenClaw 中配置 Coding Plan

2.1,API Key 和 Base URL

  • API Key:访问Coding Plan 页面,获取Coding Plan 专属 API Key(格式为sk-sp-xxxxx)。
  • Base URL:根据 AI 工具支持的 API 协议,使用以下对应的 Base URL。
    • OpenAI 兼容协议:https://coding.dashscope.aliyuncs.com/v1
    • Anthropic 兼容协议:https://coding.dashscope.aliyuncs.com/apps/anthropic

各工具使用的兼容协议请参见对应的接入文档。

说明
Coding Plan 专属的 API Key 和 Base URL 与百炼按量计费的 API Key(sk-xxxxx)和BaseURL(https://dashscope.aliyuncs.com/xxxxxx)不互通,请勿混用。

2.2,Coding Plan 支持主流的AI工具:

  • OpenClaw :开源、自托管个人 AI 助手
  • OpenCode:开源 AI 编程代理工具
  • Claude Code:AI 终端编码助手,支持自然语言编程
  • Codex:OpenAI 推出的命令行编程工具
  • Cline:VS Code 扩展,智能代码补全和调试
  • CursorAI :原生代码编辑器
  • Qwen Code:专为 Qwen3-Coder 优化的开源命令行 AI 工具
  • Kilo CLI:轻量高性能命令行编程工具
  • Kilo Code:IDE 扩展,高效编码助手

2.3,配置 Coding Plan

  1. 打开配置文件。
    运行以下命令打开 Web UI,然后在Web UI的左侧菜单栏中选择Config > Raw。
openclaw dashboard
  1. 修改配置文件。
    在 JSON 根对象中加入如下 models 配置(如果已存在则替换)。请将 YOUR_API_KEY 替换为您的 Coding Plan API Key。
"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": 204800,
          "maxTokens": 131072
        },
        {
          "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": {}
}

以下是修改后的完整配置文件示例

完整配置文件示例(您的实际配置可能包含更多配置项)

注:请将 YOUR_API_KEY 替换为您的 Coding Plan API key。

{
  "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": 204800,
            "maxTokens": 131072
          },
          {
            "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"
  }
}
  1. 保存配置。
    如果在Web UI中修改,先单击右上角 Save 保存,然后单击 Update来使配置生效。
    如果在终端中修改,先保存文件并退出,然后运行以下命令来使配置生效。
openclaw gateway restart

3,使用 OpenClaw

在终端中运行以下命令,以 Web UI 方式使用 OpenClaw。

执行/model命令可以在当前会话中切换模型。例如,执行如下命令可以切换到qwen3-coder-next模型。

/model qwen3-coder-next

注:如需在每次新会话中都使用指定模型,请参考前面的步骤修改配置文件中的primary字段。

4,常见问题

为什么报错"HTTP 401: Incorrect API key provided."?
可能原因:

  1. API Key 无效、过期、为空、格式错误,或与端点环境不匹配,请检查 API Key 是否为 Coding Plan 套餐专属 Key,复制完整且无空格;确认订阅状态有效。
  2. OpenClaw的历史配置缓存导致配置错误,请删除~/.openclaw/agents/main/agent/models.json文件中的providers.bailian配置项,并重启OpenClaw。

以上就是在OpenClaw中配置和使用Coding Plan的详细步骤的详细内容,更多关于OpenClaw配置和使用Coding Plan的资料请关注脚本之家其它相关文章!

相关文章

最新评论