OpenClaw本地连接千问(OpenClaw 接入阿里云百炼模型服务)
处理报错: HTTP 401: invalid access token or token expired
·
报错 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文档
如果觉得不错,请点赞、收藏和关注,感谢支持!
更多推荐

所有评论(0)