SuperAPI AI 工具集

iblai-router

智能体与模型

查看项目

更新于 10-15 22:16

技能介绍

用途:iblai-router 是面向 OpenClaw 的成本优化模型路由器,作为零依赖代理位于 OpenClaw 与 Anthropic API 之间,用 14 维加权评分器(开销低于 1ms)把每个请求路由到最便宜且够用的模型。

主要能力:按 LIGHT/MEDIUM/HEAVY 三档选择模型,默认对应 claude-3-5-haiku-20241022、claude-sonnet-4-20250514、claude-opus-4-20250514;通过关键词列表(simpleKeywords、relayKeywords 推向 LIGHT;imperativeVerbs、codeKeywords、agenticKeywords 推向 MEDIUM;technicalKeywords、reasoningKeywords、domainKeywords 推向 HEAVY)控制分档,边界与权重可在 config.json 调整。

使用方式:运行安装脚本 bash "$(dirname "$0")/scripts/install.sh",它会复制 server.js 与 config.json 到 ~/.openclaw/workspace/router/,创建并启动 systemd 服务 iblai-router(端口 8402),并注册 iblai-router/auto 为 OpenClaw 模型提供方。之后可在任意接受模型 ID 的位置使用 iblai-router/auto:Cron 任务在 job config 中设置模型;子代理用 agents.defaults.subagents.model = "iblai-router/auto";单会话用 /model iblai-router/auto;全部会话用 agents.defaults.model.primary = "iblai-router/auto"。可用 curl -s http://127.0.0.1:8402/health | jq . 与 curl -s http://127.0.0.1:8402/stats | jq . 验证。配置位于 ~/.openclaw/workspace/router/config.json,保存后热重载,无需重启。

适用场景:建议主交互会话保持固定模型(如 Opus),把路由器用于 Cron 任务、子代理和后台任务,以累积节省成本。

限制与注意:非 Anthropic 模型(OpenAI、Google)需把 apiBaseUrl 设为 https://openrouter.ai/api/v1 并修改 models 分档,切换提供方时需更新 systemd 服务中的 API key,然后 systemctl daemon-reload && systemctl restart iblai-router。卸载运行 bash "$(dirname "$0")/scripts/uninstall.sh",会停止服务、移除 systemd 单元并删除路由文件;卸载前应先把使用 iblai-router/auto 的工作负载切回直接模型。其余细节暂未提供。