更换 OpenClaw API Key 为 硅基流动 Siliconflow 的方式
本文介绍了在OpenClaw中使用硅基流动API的配置方法。首先需注册硅基流动账号并获取API Key,确认接口地址和模型名称。配置方法有两种:一是通过命令行设置API参数和模型列表,包括指定baseUrl、apiKey及多个模型ID;二是直接修改配置文件(openclaw.json),添加硅基流动的provider配置和模型参数。两种方法最后都需要重启gateway服务,并通过命令验证模型是否配
·
参考硅基流动官方文档硅基流动-文档-场景示例-OpenClaw
第 1 步:准备好硅基流动 API
-
使用硅基流动注册链接该链接进行注册
-
进行实名认证
-
生成 API Key
-
确认以下信息
- 硅基流动 API Key (密钥)
- 以 sk- 开头的字符串。
- Base URL (接口地址)
- 地址: https://api.siliconflow.cn/v1
- 重要: 务必包含末尾的 /v1
- 模型名称
- 请在硅基流动模型广场复制完整模型名称,如:deepseek-ai/DeepSeek-V3
- 硅基流动 API Key (密钥)
第 2 步:修改模型
方法一:使用命令行
- baseUrl :保持默认
- apiKey:使用自己的 API Key,sk 开头的
- id: 修改为你需要的模型,从模型广场上复制
- name: 自定义即可,一般是 id 的最后一段
openclaw config set 'models.providers.siliconflow' --json '{
"baseUrl": "https://api.siliconflow.cn/v1",
"apiKey": " 你的 API Key",
"api": "openai-completions",
"models": [
{ "id": "Pro/zai-org/GLM-5", "name": "GLM-5" },
{ "id": "Pro/MiniMaxAI/MiniMax-M2.5", "name": "MiniMax-M2.5" },
{ "id": "zai-org/GLM-4.6", "name": "GLM-4.6" },
]
}'
openclaw config set models.mode merge
openclaw models set siliconflow/Pro/zai-org/GLM-5
openclaw models set siliconflow/Pro/MiniMaxAI/MiniMax-M2.5
openclaw models set siliconflow/zai-org/GLM-4.6
openclaw gateway restart
方法二:修改配置文件
打开配置文件(~/.openclaw/openclaw.json)
修改前务必备份配置文件
将以下内容复制并合并到您的文件中(注意替换您的 API Key 和您需要的模型 id。 注:如果已经配置过自定义模型请从第三行开始合并到文件中。
"models": {
"providers": {
"siliconflow": {
"baseUrl": "https://api.siliconflow.cn/v1",
"apiKey": "您的_SILICONFLOW_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "zai-org/GLM-4.6",
"name": "GLM-4.6",
"reasoning": false,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
},
将以下内容合并到 openclaw.json 中的 agents 配置项中(如下图)。
siliconflow/zai-org/GLM-4.6 中的模型模型 id 需与您上一步配置的模型 id 保持一致,建议先将模型配置到:fallbacks 中,以避免模型配置不正确而导致错误。

在终端输入 openclaw models list 就可以看到您配置的 siliconflow 模型。
更多推荐

所有评论(0)