openclaw 不是命令,可以使用 clawdbot 代替。ANTHROPIC_BASE_URL 来设置自定义 API 端点。必须通过配置文件的 models.providers 来配置。| 系统 | 配置文件路径 |
|---|---|
| Windows | C:\Users\你的用户名\.clawdbot\clawdbot.json |
| macOS | ~/.clawdbot/clawdbot.json 或 ~/openclaw/clawdbot.json |
| Linux | ~/.clawdbot/clawdbot.json 或 ~/openclaw/clawdbot.json |
.clawdbot 或 openclaw 目录,取决于你的安装方式。copy %USERPROFILE%\.clawdbot\clawdbot.json %USERPROFILE%\.clawdbot\clawdbot.json.baknotepad %USERPROFILE%\.clawdbot\clawdbot.json{
"models": {
"mode": "merge",
"providers": {
"api-proxy-gpt": {
"baseUrl": "https://apipro.maynor1024.live/v1",
"api": "openai-completions",
"apiKey": "sk-你的API密钥",
"models": [
{
"id": "gpt-4o",
"name": "GPT-4o",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 128000,
"maxTokens": 8192
}
]
},
"api-proxy-claude": {
"baseUrl": "https://apipro.maynor1024.live",
"api": "anthropic-messages",
"apiKey": "sk-你的API密钥",
"models": [
{
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
},
"api-proxy-google": {
"baseUrl": "https://apipro.maynor1024.live/v1beta",
"api": "google-generative-ai",
"apiKey": "sk-你的API密钥",
"models": [
{
"id": "gemini-3-pro-preview",
"name": "Gemini 3 Pro",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 2000000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "api-proxy-claude/claude-sonnet-4-5-20250929"
},
"models": {
"api-proxy-gpt/gpt-4o": {
"alias": "GPT-4o"
},
"api-proxy-claude/claude-sonnet-4-5-20250929": {
"alias": "Claude Sonnet 4.5"
},
"api-proxy-google/gemini-3-pro-preview": {
"alias": "Gemini 3 Pro"
}
}
}
},
"auth": {
"profiles": {
"api-proxy-gpt:default": {
"provider": "api-proxy-gpt",
"mode": "api_key"
},
"api-proxy-claude:default": {
"provider": "api-proxy-claude",
"mode": "api_key"
},
"api-proxy-google:default": {
"provider": "api-proxy-google",
"mode": "api_key"
}
}
}
}| 字段 | 说明 | 必需 |
|---|---|---|
baseUrl | 自定义 API 端点地址 | ✅ |
apiKey | 你的 API 密钥(直接写在这里) | ✅ |
api | API 类型 | ✅ |
models | 模型列表配置 | ✅ |
sk-你的API密钥 替换为你的真实 API Key!| 系统 | 鉴权文件路径 |
|---|---|
| Windows | C:\Users\你的用户名\.clawdbot\agents\main\agent\auth-profiles.json |
| macOS | ~/.clawdbot/agents/main/agent/auth-profiles.json 或~/openclaw/agents/main/agent/auth-profiles.json |
| Linux | ~/.clawdbot/agents/main/agent/auth-profiles.json 或~/openclaw/agents/main/agent/auth-profiles.json |
notepad %USERPROFILE%\.clawdbot\agents\main\agent\auth-profiles.json{
"version": 1,
"profiles": {
"api-proxy-gpt:default": {
"type": "api_key",
"provider": "api-proxy-gpt",
"key": "sk-你的API密钥"
},
"api-proxy-claude:default": {
"type": "api_key",
"provider": "api-proxy-claude",
"key": "sk-你的API密钥"
},
"api-proxy-google:default": {
"type": "api_key",
"provider": "api-proxy-google",
"key": "sk-你的API密钥"
}
},
"lastGood": {
"api-proxy-gpt": "api-proxy-gpt:default",
"api-proxy-claude": "api-proxy-claude:default",
"api-proxy-google": "api-proxy-google:default"
}
}sk-你的API密钥 替换为你的真实 API Key!🚀 OpenClaw Gateway starting...
📡 WebSocket server listening on ws://127.0.0.1:18789
🌐 Web interface available at http://127.0.0.1:18789
✨ Gateway ready!你好http://127.0.0.1:18789/openclaw onboard 结尾输出的 Token 登录。| 命令 | 说明 |
|---|---|
/models | 查看所有可用模型 |
/model api-proxy-gpt/gpt-4o | 切换到 GPT-4o |
/model api-proxy-claude/claude-sonnet-4-5-20250929 | 切换到 Claude Sonnet 4.5 |
/model api-proxy-google/gemini-3-pro-preview | 切换到 Gemini 3 Pro |
/model status | 查看当前模型状态 |
/clear | 清空对话历史 |
/save | 保存当前会话 |
/quit | 退出 TUI |
clawdbot.json 中的 apiKey 字段auth-profiles.json 中的 key 字段baseUrl 是否正确:https://apipro.maynor1024.live/v1https://apipro.maynor1024.livehttps://apipro.maynor1024.live/v1betaPort 18789 already in usenetstat -ano | findstr :18789
taskkill /PID <PID> /Fopenclaw onboard 初始化mkdir %USERPROFILE%\.clawdbot\agents\main\agent主配置文件:
C:\Users\你的用户名\.clawdbot\clawdbot.json
鉴权文件:
C:\Users\你的用户名\.clawdbot\agents\main\agent\auth-profiles.json主配置文件:
~/.clawdbot/clawdbot.json
或
~/openclaw/clawdbot.json
鉴权文件:
~/.clawdbot/agents/main/agent/auth-profiles.json
或
~/openclaw/agents/main/agent/auth-profiles.jsonGet-ChildItem -Path $env:USERPROFILE -Filter "clawdbot.json" -Recurse -ErrorAction SilentlyContinueclawdbot.json 不是 config.json~/.clawdbot/clawdbot.json~/openclaw/clawdbot.jsonclawdbot.json 的 models.providers[].apiKeyauth-profiles.json 的 profiles[].key/v1 后缀/v1beta 后缀clawdbot.json(包含 apiKey)auth-profiles.json(包含 key)clawdbot.json,不是 config.json~/.clawdbot/ 或 ~/openclaw/ 目录find 命令查找配置文件位置