⚙️ 概览

OmniRoute (v3.8.50) 是一款强劲的开源 AI 统一网关(Free AI Gateway)。它将全球 290+ 厂商 / 500+ 模型(含 90+ 免费层、每月约 15.3 亿免费 Token 额度)聚合为单一 OpenAI / Claude / Gemini 兼容 API 端点,支持无感知自动降级与智能路由。

  • 版本: OmniRoute v3.8.48+ (release/v3.8.50 架构)
  • 后端 API 端口: 20128 (http://localhost:20128/v1)
  • 控制面板 Dashboard: http://localhost:20128
  • 底层压缩管道: RTK + Caveman 压缩 (平均节省 15%~95% Token 消耗)
  • 支持客户端: Hermes Agent, OpenClaw, Claude Code, Cursor, Cline, Antigravity, Codex 等

🚀 核心架构与路由模式

OmniRoute 提供了 19 种高可用智能路由策略:

  1. auto (默认开箱即用模式): 零配置自动路由,结合 12 维实时评分自动在免费池、免费额度与付费 API 间做无缝 Failover 降级。
  2. auto/coding: 编程专用调优模式 (优先匹配高质量代码模型)。
  3. auto/fast: 延迟优先模式。
  4. auto/cheap: 成本优先模式。
  5. auto/smart: 探索模式 (10% 权重测试最新模型)。

💻 常用 CLI 控制指令

# 1. 查看 OmniRoute 运行状态与检测到的本地 AI 工具 (如 Hermes)
omniroute status

# 2. 交互式对话测试 (使用 auto 零配置智能路由)
omniroute chat "Hello! Introduce yourself."

# 3. 开启服务 / 重启服务
omniroute serve --daemon
omniroute restart

# 4. 一键为客户端工具注入配置 (如为 Hermes / Claude Code / Codex 生成 Config)
omniroute setup-claude
omniroute setup-codex
omniroute setup-opencode

🌐 结合 Nginx 反向代理配置模板 (ous VPS)

可以在反代服务器 ous 的 /etc/nginx/conf.d/omniroute.conf 中配置(可映射端口 25781 或直接转发至 20128):

server {
  listen 80;
  listen [::]:80;
  server_name route.rxm.xyz;
  return 301 https://$host$request_uri;
}

server {
  listen 443 ssl;
  listen [::]:443 ssl;
  http2 on;
  server_name route.rxm.xyz;

  ssl_certificate     /var/www/ssl/de_GWD.cer;
  ssl_certificate_key /var/www/ssl/de_GWD.key;

  location / {
    proxy_pass http://[2a01:4f9:6b:4a8f:6c::e]:20128;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    # 支持长连接对话与流式 SSE 响应
    proxy_buffering off;
    proxy_read_timeout 3600;
  }
}