返回顶部
i

iblai-router智能模型路由

Cost-optimizing model router for OpenClaw. Automatically routes each request to the cheapest capable Claude model (Haiku/Sonnet/Opus) using weighted scoring. Use when setting up smart model routing, reducing API costs, or configuring multi-tier LLM routing. Supports Anthropic models directly and OpenAI/Google models via OpenRouter.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
611
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

iblai-router

iblai-router

一个零依赖代理,位于OpenClaw与Anthropic API之间,使用14维加权评分器(开销<1毫秒)将每个请求路由到最便宜的可用模型。

安装

运行安装脚本以自动完成所有设置:

bash
bash $(dirname $0)/scripts/install.sh

此操作将:

  1. 1. 将server.js和config.json复制到~/.openclaw/workspace/router/
  2. 创建并启动一个systemd服务(iblai-router),监听端口8402
  3. 将iblai-router/auto注册为OpenClaw模型提供者

安装完成后,iblai-router/auto可在任何OpenClaw接受模型ID的地方使用。

验证

bash
curl -s http://127.0.0.1:8402/health | jq .
curl -s http://127.0.0.1:8402/stats | jq .

使用

将iblai-router/auto设置为任何作用域的模型:

作用域方法
定时任务在任务配置中将model设置为iblai-router/auto
子代理
agents.defaults.subagents.model = iblai-router/auto |
| 单次会话 | /model iblai-router/auto |
| 所有会话 | agents.defaults.model.primary = iblai-router/auto |

提示: 将主要交互会话保留在固定模型上(例如Opus)。将路由器用于定时任务、子代理和后台任务,这些场景下成本节省会不断累积。

自定义

所有配置位于~/.openclaw/workspace/router/config.json,保存后热重载——无需重启。

模型

按层级更改模型:

json
{
models: {
LIGHT: claude-3-5-haiku-20241022,
MEDIUM: claude-sonnet-4-20250514,
HEAVY: claude-opus-4-20250514
}
}

非Anthropic模型(OpenAI、Google)

设置apiBaseUrl以通过OpenRouter路由:

json
{
models: {
LIGHT: openai/gpt-4.1-mini,
MEDIUM: openai/gpt-4.1,
HEAVY: openai/o3
},
apiBaseUrl: https://openrouter.ai/api/v1
}

切换提供商时更新systemd服务中的API密钥,然后执行systemctl daemon-reload && systemctl restart iblai-router。

评分

关键词列表控制哪个层级处理请求:

  • - simpleKeywords、relayKeywords → 推向LIGHT(便宜)
  • imperativeVerbs、codeKeywords、agenticKeywords → 推向MEDIUM
  • technicalKeywords、reasoningKeywords、domainKeywords → 推向HEAVY(能力强)

在config.json中调整边界和权重以匹配您的工作负载。详情请参阅完整README

卸载

bash
bash $(dirname $0)/scripts/uninstall.sh

停止服务,移除systemd单元,并删除路由器文件。提醒:请先将任何使用iblai-router/auto的工作负载切换回直接模型。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 iblai-openclaw-router-1776420056 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 iblai-openclaw-router-1776420056 技能

通过命令行安装

skillhub install iblai-openclaw-router-1776420056

下载

⬇ 下载 iblai-router v1.0.0(免费)

文件大小: 22.03 KB | 发布时间: 2026-4-17 19:50

v1.0.0 最新 2026-4-17 19:50
- Initial release of iblai-router: a zero-dependency, cost-optimizing proxy for OpenClaw.
- Automatically routes requests to the cheapest capable Claude model (Haiku, Sonnet, Opus) using a weighted scoring system.
- Supports Anthropic models directly; OpenAI and Google models supported via OpenRouter integration.
- Easy installation, health verification, and customizable configuration without service restarts.
- Scoring algorithm leverages keyword lists to select appropriate model tier for each request.
- Includes simple uninstall script and guidance for safely switching workloads.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部