OpenClaw
更新时间 2026-03-31 01:30:47
最近更新时间: 2026-03-31 01:30:47
本文为您介绍编码套餐接入OpenClaw的详细步骤。
openClaw 添加模型配置
方式一:通过Web UI修改配置文件(适用于Windows或者Mac系统)
在终端执行以下命令打开 Web UI。
openclaw dashboard在Web UI的左侧菜单栏中选择 “配置”-> “All Settings” -> “RAW”。
复制以下内容(以GLM MAX(旗舰版)为例)到Raw JSONS输入框,替换已有内容,并将YOUR_API_KEY替换为为你购买的编程套餐专属的API Key。
注意
配置models下的id和model_name来源于您当前购买实际套餐的可用模型,以下示例配置以GLM MAX(旗舰版)为例,不同编码套餐支持调用的模型不一样
{
"models": {
"mode": "merge",
"providers": {
"xirang": {
"baseUrl": "https://wishub-x6.ctyun.cn/coding/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "GLM-5",
"name": "GLM-5",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-5-Turbo",
"name": "GLM-5-Turbo",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-5.1",
"name": "GLM-5.1",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-4.7",
"name": "GLM-4.7",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-4.6",
"name": "GLM-4.6",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-4.5",
"name": "GLM-4.5",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 131072,
"maxTokens": 65536
},
{
"id": "GLM-4.5-Air",
"name": "GLM-4.5-Air",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 131072,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "xirang/GLM-5"
},
"models": {
"xirang/GLM-5": {},
"xirang/GLM-5-Turbo": {},
"xirang/GLM-5.1": {},
"xirang/GLM-4.7": {},
"xirang/GLM-4.6": {},
"xirang/GLM-4.5": {},
"xirang/GLM-4.5-Air": {}
}
}
},
"gateway": {
"mode": "local"
}
}点击右上角 Save 保存,再点击 Update 使配置生效,保存成功后,apiKey将显示为“__OPENCLAW_REDACTED__”。由于脱敏保护,仅在前端界面隐藏,不影响实际调用。
方式二:通过终端修改配置文件(适用于Windows 、mac 系统、Linux系统)
在终端执行以下命令打开配置文件
Mac系统和Linux系统执行以下命令:
nano ~/.openclaw/openclaw.jsonWindows系统执行以下命令(Windows系统推荐优先使用方式一):
notepad %USERPROFILE%\.openclaw\openclaw.json复制以下内容(以GLM MAX(旗舰版)为例)到配置文件。将YOUR_API_KEY替换为你购买的编程套餐专属的API Key。
{
"models": {
"mode": "merge",
"providers": {
"xirang": {
"baseUrl": "https://wishub-x6.ctyun.cn/coding/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "GLM-5",
"name": "GLM-5",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-5-Turbo",
"name": "GLM-5-Turbo",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-5.1",
"name": "GLM-5.1",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-4.7",
"name": "GLM-4.7",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-4.6",
"name": "GLM-4.6",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
},
{
"id": "GLM-4.5",
"name": "GLM-4.5",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 131072,
"maxTokens": 65536
},
{
"id": "GLM-4.5-Air",
"name": "GLM-4.5-Air",
"reasoning": true,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 131072,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "xirang/GLM-5"
},
"models": {
"xirang/GLM-5": {},
"xirang/GLM-5-Turbo": {},
"xirang/GLM-5.1": {},
"xirang/GLM-4.7": {},
"xirang/GLM-4.6": {},
"xirang/GLM-4.5": {},
"xirang/GLM-4.5-Air": {}
}
}
},
"gateway": {
"mode": "local"
}
}注意
配置models下的id 和 model_name 来源于当前购买套餐的可用模型,以下配置以GLM MAX(旗舰版)为例,不同编码套餐需要置换为不同的模型名称
openClaw 使用
方式一:Windows或者Mac环境
新开一个终端,运行以下命令。
openclaw dashboard在Web UI点击左侧顶部“聊天”进入聊天窗口后,输入Message进行对话。
方式二:Linux环境
新开一个终端,运行以下命令,进入TUI界面。
openclaw tui在TUI界面进行对话。