Documentation Index Fetch the complete documentation index at: https://docs.foxapi.cc/llms.txt
Use this file to discover all available pages before exploring further.
OpenClaw 是一个开源的 AI Agent 网关,用于将聊天应用桥接到 AI 编程 Agent。它支持多种 AI 模型提供商和 API 格式,让你可以通过统一的网关连接 Claude Code、Cursor 等 AI 编程工具。
本指南将引导你从零开始手动安装 OpenClaw 并将其连接到 FoxAPI。
前置条件
FoxAPI API Key 一个有效的 FoxAPI API Key。
Node.js Node.js >= 22.12.0。
安装与配置
安装 OpenClaw
通过 npm 全局安装 OpenClaw: npm install -g openclaw@latest
运行初始化
运行 onboarding 命令以初始化 OpenClaw 并安装后台守护进程: openclaw onboard --install-daemon
该命令会创建配置目录和默认配置文件。
配置模型提供商
编辑主配置文件,添加 FoxAPI 作为模型提供商。 ~ /.openclaw/openclaw.json
%USERPROFILE%\.openclaw\openclaw.json
在 models.providers 部分,添加以下三个提供商配置块(分别对应不同的 API 格式): {
"models" : {
"providers" : {
"foxapi-anthropic" : {
"api" : "anthropic-messages" ,
"baseUrl" : "https://api.foxapi.cc" ,
"apiKey" : "sk-your-foxapi-api-key" ,
"models" : [
{ "id" : "claude-opus-4-6" , "name" : "Claude Opus 4.6" },
{ "id" : "claude-sonnet-4-20250514" , "name" : "Claude Sonnet 4" }
]
},
"foxapi-google" : {
"api" : "google-generative-ai" ,
"baseUrl" : "https://api.foxapi.cc/v1beta" ,
"apiKey" : "sk-your-foxapi-api-key" ,
"models" : [
{ "id" : "gemini-2.5-pro" , "name" : "Gemini 2.5 Pro" },
{ "id" : "gemini-2.5-flash" , "name" : "Gemini 2.5 Flash" }
]
},
"foxapi-openai" : {
"api" : "openai-completions" ,
"baseUrl" : "https://api.foxapi.cc/v1" ,
"apiKey" : "sk-your-foxapi-api-key" ,
"models" : [
{ "id" : "gpt-4o" , "name" : "GPT-4o" },
{ "id" : "deepseek-chat" , "name" : "DeepSeek V3" }
]
}
}
}
}
请将所有三个提供商配置块中的 sk-your-foxapi-api-key 替换为你的实际 FoxAPI API Key。
配置默认 Agent 模型
编辑 Agent 模型配置文件以设置默认模型: ~ /.openclaw/agents/main/agent/models.json
%USERPROFILE%\.openclaw\agents\main\agent\models.json
在 agents 字段中设置主模型: {
"model" : {
"primary" : "foxapi-anthropic/claude-opus-4-6"
}
}
格式为 <提供商名称>/<模型ID>。
验证连接
切换到指定模型以确认其可用:
openclaw model switch foxapi-anthropic/claude-opus-4-6
启动与 Agent 的对话,测试连接是否正常。
如果能正常收到响应,说明 FoxAPI 集成已成功。
切换模型
你可以随时使用以下命令切换当前活跃模型:
openclaw model switch < 提供 商 > / < 模型I D >
示例:
# 切换到 Claude Sonnet 4
openclaw model switch foxapi-anthropic/claude-sonnet-4-20250514
# 切换到 Gemini 2.5 Pro
openclaw model switch foxapi-google/gemini-2.5-pro
# 切换到 GPT-4o
openclaw model switch foxapi-openai/gpt-4o
常见问题
确认 Node.js 版本 >= 22.12.0:node --version
重新安装 OpenClaw:npm install -g openclaw@latest
检查 npm 全局 bin 目录是否在系统 PATH 中。
检查 openclaw.json 中的 apiKey 和 baseUrl 是否正确。
确认各 API 格式对应的 Base URL:
Anthropic:https://api.foxapi.cc
Google:https://api.foxapi.cc/v1beta
OpenAI:https://api.foxapi.cc/v1
使用 curl 测试 API Key 是否有效:
curl https://api.foxapi.cc/v1/models \
-H "Authorization: Bearer sk-your-foxapi-api-key"
确认提供商名称和模型 ID 与 openclaw.json 中定义的完全一致。
格式必须为 <提供商>/<模型ID>,例如 foxapi-anthropic/claude-opus-4-6。
重新运行初始化命令:openclaw onboard --install-daemon
检查系统日志获取守护进程错误信息。