OpenClaw 是一款开源的个人 AI 助手平台,支持多模型接入、自动化任务和本地化操作。本指南介绍如何将 放心API 接入 OpenClaw。
~/.openclaw/openclaw.jsonmodels 部分替换为以下内容。两个 provider 使用不同的 API Key,请分别在放心API控制台创建对应分组的密钥后填入:{
"models": {
"mode": "merge",
"providers": {
"fangxin_claude": {
"baseUrl": "https://fangxinapi.com",
"apiKey": "放心API【Claude Code 分组】的 API Key",
"api": "anthropic-messages",
"models": [
{
"id": "claude-sonnet-4-6",
"name": "claude-sonnet-4-6",
"api": "anthropic-messages",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"api": "anthropic-messages",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
},
"fangxin_codex": {
"baseUrl": "https://fangxinapi.com/v1",
"apiKey": "放心API【Codex 分组】的 API Key",
"api": "openai-completions",
"models": [
{
"id": "gpt-5.4",
"name": "GPT-5.4",
"reasoning": true,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 204800,
"maxTokens": 131072
}
]
}
}
}
}| fangxin_claude | fangxin_codex | |
|---|---|---|
| 对应厂商 | Anthropic Claude | OpenAI Codex |
| baseUrl | https://fangxinapi.com | https://fangxinapi.com/v1 |
| API 格式 | anthropic-messages | openai-completions |
| 放心API分组 | Claude Code 分组 | Codex 分组 |
| 模型 ID(不可改) | name(可自定义) | 说明 |
|---|---|---|
claude-sonnet-4-6 | Claude Sonnet 4.6 | Claude Sonnet 最新版,速度与能力均衡 |
claude-opus-4-6 | Claude Oopus 4.6 | Claude Opus 最新版,能力最强 |
| 模型 ID(不可改) | name(可自定义) | 说明 |
|---|---|---|
gpt-5.4 | GPT-5.4 | OpenAI 最新代码生成模型 |
id 字段必须与放心API支持的模型 ID 完全一致,填错会导致请求失败。name 字段仅用于在 OpenClaw 界面中显示,可以自由修改为任意名称。Ctrl + X → Y → 回车)。/model fangxin_claude/claude-sonnet-4-6
/model fangxin_claude/claude-opus-4-6
/model fangxin_codex/gpt-5.4provider名/模型ID,与配置文件中的 fangxin_claude、fangxin_codex 和各模型的 id 字段对应。baseUrl 填写正确,末尾不要有多余的斜杠(/)apiKey 已替换为实际密钥,不是占位文字