Install
openclaw skills install codex-adapter-toolkitCodex Adapter Toolkit - Multi-provider API adapter for Codex. Use when: user wants to switch Codex API provider, set up local adapter for DeepSeek/MiniMax/OpenAI/Gemini, configure failover, or manage multiple providers.
openclaw skills install codex-adapter-toolkitCodex Adapter Toolkit 提供统一的本地 API 适配器,支持多种大模型 Provider:
| Provider | 类型 | 认证方式 |
|---|---|---|
| DeepSeek | deepseek | Bearer Token |
| MiniMax | minimax | API Key |
| OpenAI | openai | Bearer Token |
| Google Gemini | gemini | API Key |
| xAI Grok | grok | Bearer Token |
| Ollama (本地) | ollama | 无 |
| Claude Direct | claude_direct | Bearer Token |
| OpenRouter | openrouter | Bearer Token |
Codex (Responses API) → http://127.0.0.1:<port>/v1/responses
↓ 本地适配器(协议转换)
第三方 API (Chat Completions API)
127.0.0.1:<port>Responses API 转换为各厂商的 Chat Completions API| Provider | 端口 |
|---|---|
| DeepSeek | 18669 |
| MiniMax | 18667 |
| 讯飞 | 18666 |
| 自定义 | 可配置 |
.\scripts\setup.ps1
.\scripts\install-adapter.ps1 -Provider deepseek -ApiKey "your-api-key"
.\scripts\switch-provider.ps1 -Provider openai
.\scripts\diagnose.ps1
python adapters/universal_adapter.py <端口> <provider类型> [api_key] [failover备选...]
示例:
# DeepSeek 主节点
python adapters/universal_adapter.py 18669 deepseek "sk-xxxx"
# 带故障切换(DeepSeek 主,OpenAI/Gemini 备选)
python adapters/universal_adapter.py 18669 deepseek "sk-xxxx" openai gemini
# 本地 Ollama
python adapters/universal_adapter.py 18669 ollama
# 启动 DeepSeek 适配器
python deepseek_codex_adapter.py
# 启动 MiniMax 适配器
python minimax_codex_adapter.py
| 脚本 | 功能 |
|---|---|
setup.ps1 | 一键安装所有组件 |
install-adapter.ps1 | 安装适配器 |
switch-provider.ps1 | 切换 Provider |
monitor-adapter.ps1 | 进程监控(自动重启) |
failover.ps1 | 故障切换测试 |
diagnose.ps1 | 智能诊断 |
notify.ps1 | 通知系统配置 |
backup.ps1 | 备份与恢复 |
apikey.ps1 | API Key 管理 |
usage-stats.ps1 | 使用统计 |
logs.ps1 | 日志查看 |
dashboard-server.ps1 | Web 监控面板 |
register-startup.ps1 | 注册开机启动 |
适配器配置文件位于用户目录下:
%USERPROFILE%\.cc-switch\settings.json当 Provider 失败达到阈值时自动熔断:
熔断状态可通过健康检查端点查看:
curl http://127.0.0.1:18669/health
配置 failover providers:
python universal_adapter.py 18669 deepseek "key" openai gemini
主节点故障时自动切换到备选节点。
启动 Dashboard 服务器:
.\scripts\dashboard-server.ps1
然后访问 http://localhost:18670 查看实时状态。
配置通知渠道:
# 钉钉
.\notify.ps1 -Config -Channel dingtalk -ConfigAction set -ConfigValue "https://oapi.dingtalk.com/..."
# 邮件
.\notify.ps1 -Config -Channel email -ConfigAction set -ConfigValue "smtp:port:user:pass:from:to"
发送测试通知:
.\notify.ps1 -Test -Channel dingtalk
# 备份
.\backup.ps1
# 列出备份
.\backup.ps1 -Action list
# 恢复
.\backup.ps1 -Action restore latest
# 1. 检查进程
Get-Process python | Where-Object { $_.CommandLine -like "*adapter*" }
# 2. 健康检查
curl http://127.0.0.1:18669/health
# 3. 诊断
.\diagnose.ps1
v1.0.0