Router 接口
本文档基于当前代理实现整理,覆盖模型代理入口与仪表盘查询入口。
基础信息
- Base URL:
https://api.xaicontrol.com - 认证:
Authorization: Bearer sk-Xvs...
export BASE_URL="https://api.xaicontrol.com"
curl ${BASE_URL}/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'
兼容接口(代理)
OpenAI 兼容
/v1/chat/completions/v2/chat/completions/chat/completions/v1/responses/responses/v1/embeddings/embeddings/v1/images/generations/v1/images/edits/v1/images/variations/v1/audio/transcriptions/v1/audio/translations/v1/realtime/client_secrets/v1/realtime(WebSocket)/v1/moderations/v1/threads/v1/files/v1/models、/models
Claude 兼容
/v1/messages/messages
仪表盘查询接口(同域 GET)
/dashboard/status/dashboard/info/dashboard/live/dashboard/bill/dashboard/logs/dashboard/news/dashboard/models
路由策略(代码行为)
1) 模型映射
请求模型会按配置映射:
- 用户级
ModelMapper - Owner 级
ModelMapper
2) Level 路由
通过 LevelMapper 选择密钥池 Level,并在该 Level 内轮询密钥。
3) 故障转移
支持两层故障转移:
ModelFailover(模型备用链)SwitchOver(Level 切换)
4) ACL 与限速
请求会经过:
- IP 白名单(
AllowIPs) - 资源白名单(
Resources) - 模型白名单(
AllowModels) - 用户限速与模型级
ModelLimits