报错 HTTP 401: invalid access token or token expired

错误描述:

无效的token或者token过期

原因:

千问提供的阿里云百炼免费API端口和正常付费使用的API接口不一样,并且只有指定API模型支持使用,需要进行选择并且修改配置。(我这里使用的是qwen3-max)

模型支持截图

处理方式(修改openclaw.json内容):

Windows目录文件:C:\Users\admin\.openclaw\openclaw.json
MAC目录文件:~/.openclaw/openclaw.json

YOUR_APIKEY:为你申请的千问api-key (sk-xxxxxxxxx)
YOUR_TOKEN:为你配置的OpenClaw登录token(默认在你配置完成OpenClaw自动生成)

{
  "meta": {
    "lastTouchedVersion": "2026.2.1",
    "lastTouchedAt": "2026-02-03T08:20:00.000Z"
  },
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
        "apiKey": "YOUR_APIKEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3-max",
            "name": "qwen3-max",
            "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
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3-max"
      },
      "models": {
        "bailian/qwen3-max": {},
        "bailian/qwen3-coder-next": {}
      }
    }
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true,
    "ownerDisplay": "raw"
  },
  "gateway": {
    "mode": "local",
    "auth": {
      "mode": "token",
      "token": "YOUR_TOKEN"
    }
  }
}


详情请参考官方API文档

阿里云百炼

如果觉得不错,请点赞、收藏和关注,感谢支持!

Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐