OpenClaw(1) 方式二:通过终端修改配置文件(适用于Windows 、mac 系统、Linux系统) 1. 在终端执行以下命令打开配置文件 Mac系统和Linux系统执行以下命令: plaintext nano ~/.openclaw/openclaw.jsonWindows 系统执行以下命令(Windows系统推荐优先使用方式一): plaintext notepad %USERPROFILE%.openclawopenclaw.json 2. 复制以下内容(以GLM MAX(旗舰版)为例)到配置文件。将YOURAPIKEY替换为你购买的编程套餐专属的API Key。 plaintext { "models": { "mode": "merge", "providers": { "xirang": { "baseUrl": " "apiKey": "YOURAPIKEY", "api": "openaicompletions", "models": [ { "id": "GLM5", "name": "GLM5", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 204800, "maxTokens": 131072 }, { "id": "GLM5Turbo", "name": "GLM5Turbo", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 204800, "maxTokens": 131072 }, { "id": "GLM5.1", "name": "GLM5.1", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 204800, "maxTokens": 131072 }, { "id": "GLM4.7", "name": "GLM4.7", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 204800, "maxTokens": 131072 }, { "id": "GLM4.6", "name": "GLM4.6", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 204800, "maxTokens": 131072 }, { "id": "GLM4.5", "name": "GLM4.5", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072, "maxTokens": 65536 }, { "id": "GLM4.5Air", "name": "GLM4.5Air", "reasoning": true, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072, "maxTokens": 4096 } ] } } }, "agents": { "defaults": { "model": { "primary": "xirang/GLM5" }, "models": { "xirang/GLM5": {}, "xirang/GLM5Turbo": {}, "xirang/GLM5.1": {}, "xirang/GLM4.7": {}, "xirang/GLM4.6": {}, "xirang/GLM4.5": {}, "xirang/GLM4.5Air": {} } } }, "gateway": { "mode": "local" } } 注意 配置models下的id 和 modelname 来源于当前购买套餐的可用模型,以下配置以GLM MAX(旗舰版)为例,不同编码套餐需要置换为不同的模型名称
来自: