开发者社区 问答 正文

OpenClaw对接阿里云百炼api怎么设置?

OpenClaw对接阿里云百炼api怎么设置?阿里云支持OpenClaw龙虾AI一键部署:https://t.aliyun.com/U/WxO5TJ 如下图:

阿里云快速部署OpenClaw快速养虾.png

展开
收起
程序员在线 2026-04-02 15:32:12 89 分享 版权
1 条回答
写回答
取消 提交回答
  • 要将 OpenClaw 对接阿里云百炼 API,需完成以下关键配置,阿里云百炼官网:https://t.aliyun.com/U/fPVHqY

    1. 获取百炼 API Key 和 Base URL

    • API Key:前往对应地域的密钥管理页面获取(如北京、新加坡或弗吉尼亚)。
    • Base URL:根据地域选择:
      • 华北2(北京):https://dashscope.aliyuncs.com/compatible-mode/v1
      • 新加坡:https://dashscope-intl.aliyuncs.com/compatible-mode/v1
      • 美国(弗吉尼亚):https://dashscope-us.aliyuncs.com/compatible-mode/v1

    百炼API Key获取,阿里云官方文档有详细说明:https://help.aliyun.com/zh/model-studio/get-api-key

    注意:Base URL、API Key 和模型必须属于同一地域。

    2. 配置方式(推荐 Web 控制台)

    方式一:通过 Web 控制台配置

    1. 运行命令启动控制台:
      openclaw dashboard
      
    2. 浏览器访问 http://127.0.0.1:18789,进入 Config > RAW
    3. "agents": {...} 前插入百炼配置,示例(以北京地域为例):
      "models": {
        "mode": "merge",
        "providers": {
          "bailian": {
            "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
            "apiKey": "YOUR_API_KEY",
            "api": "openai-completions",
            "models": [
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536
              },
              {
                "id": "qwen3-coder-next",
                "name": "qwen3-coder-next",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 262144,
                "maxTokens": 65536
              }
            ]
          }
        }
      }
      
      YOUR_API_KEY 替换为实际的百炼 API Key。

    方式二:直接编辑配置文件

    编辑 ~/.openclaw/openclaw.json,按上述结构添加配置。

    3. 关键注意事项

    • 必须设置 "reasoning": false,否则回复内容为空。
    • 若使用 Token Plan 团队版,Base URL 应为:
      https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
    • 若使用 Coding Plan,Base URL 应为:
      https://coding.dashscope.aliyuncs.com/v1,且仅限在 AI 编程工具中使用。

    配置完成后重启 OpenClaw 即可生效。

    2026-04-28 15:29:37
    赞同 13 展开评论
问答分类:
问答地址: