OpenClaw 千问大模型配置

2026-05-06阅读 0热度 0
OpenClaw 服务器 运维 数据库 wsl

一、 openClaw 安装

想在Windows 11上部署OpenClaw对吧?一个非常成熟且高效的方案,是借助WSL 2下的Ubuntu-24.04环境。这里已经有非常详尽的“一站式”部署指南,你可以直接参考这篇《Windows11 WSL 2 Ubuntu-24.04 部署OpenClaw》的实战博客,跟着一步步操作即可。

二 注册阿里百炼的千问api

有了运行环境,下一步就是获取模型服务。这里我们选用阿里百炼平台的千问模型API。访问百炼控制台,完成注册并创建一个应用,获取后续配置中至关重要的API Key。

阿里百炼控制台界面示意

三、千问配置模板

核心的配置都在一个文件里:~/.openclaw/openclaw.json。你需要将上一步从百炼获取的API Key,准确地填入以下配置模板的对应位置。尤其注意apiKeybaseUrl这两个字段。

{
  "meta": {
    "lastTouchedVersion": "2026.3.8",
    "lastTouchedAt": "2026-03-09T05:14:42.121Z"
  },
  "wizard": {
    "lastRunAt": "2026-03-09T05:14:42.107Z",
    "lastRunVersion": "2026.3.8",
    "lastRunCommand": "onboard",
    "lastRunMode": "local"
  },
  "auth": {
    "profiles": {
      "qwen-portal:default": {
        "provider": "qwen-portal",
        "mode": "oauth"
      }
    }
  },
  "models": {
    "providers": {
      "qwen-portal": {
        // 千问模型API的端点地址
        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
        // 此处替换为你从百炼控制台获取的真实API Key
        "apiKey": "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "api": "openai-completions",
        "models": [
          {
            "id": "coder-model",
            "name": "Qwen Coder",
            "reasoning": false,
            "input": ["text"],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 128000,
            "maxTokens": 8192
          },
          {
            "id": "vision-model",
            "name": "Qwen Vision",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 128000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "qwen-portal/coder-model"
      },
      "models": {
        "qwen-portal/coder-model": {
          "alias": "qwen"
        },
        "qwen-portal/vision-model": {}
      },
      "workspace": "/root/.openclaw/workspace"
    }
  },
  "tools": {
    "profile": "messaging"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true,
    "ownerDisplay": "raw"
  },
  "session": {
    "dmScope": "per-channel-peer"
  },
  "hooks": {
    "internal": {
      "enabled": true,
      "entries": {
        "command-logger": {
          "enabled": true
        },
        "boot-md": {
          "enabled": true
        },
        "bootstrap-extra-files": {
          "enabled": true
        },
        "session-memory": {
          "enabled": true
        }
      }
    }
  },
  "gateway": {
    // 网关服务端口
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token",
      // 访问WebUI时需携带此Token,格式:http://127.0.0.1:18789/#token=xxxxxxxx
      // 如果未携带Token直接访问,会返回“Unauthorized”错误
      "token": "f9274d4d49af4cb0e7bb3f2fb987e346c4b8c71811deb801"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    },
    "nodes": {
      "denyCommands": [
        "camera.snap",
        "camera.clip",
        "screen.record",
        "contacts.add",
        "calendar.add",
        "reminders.add",
        "sms.send"
      ]
    }
  },
  "plugins": {
    "entries": {
      "qwen-portal-auth": {
        "enabled": true
      }
    }
  }
}

四、启动openclaw

1. 清理openclaw 进程

为了保证干净的启动环境,建议先清理可能残留的旧进程。执行以下命令即可:

pkill -9 -f openclaw-gateway || true

2、启动openclaw

接下来就可以启动网关服务了。根据你的安装方式,选择对应的启动命令:

  • 常规启动(适用于常规安装): pnpm openclaw gatewayopenclaw gateway
  • 后台启动并指定配置(适合生产环境):
    nohup pnpm openclaw gateway run \
      --bind loopback \
      --port 18789 \
      --force \
      > gateway.log 2>&1 &

看到类似下图的输出,就意味着服务已经成功在后台运行起来了。

OpenClaw网关启动成功终端输出示意

五、WebUI连接

最后一步,就是通过Web界面来管理和使用你的AI助手了。在浏览器地址栏中输入控制面板地址即可访问。

OpenClaw Web控制面板登录界面


免责声明

本网站新闻资讯均来自公开渠道,力求准确但不保证绝对无误,内容观点仅代表作者本人,与本站无关。若涉及侵权,请联系我们处理。本站保留对声明的修改权,最终解释权归本站所有。

相关阅读

更多
欢迎回来 登录或注册后,可保存提示词和历史记录
登录后可同步收藏、历史记录和常用模板
注册即表示同意服务条款与隐私政策