Model Router Manager

智能多模型路由管理器 - 自动选择最优模型,降低成本,提高可靠性

MIT-0 · Free to use, modify, and redistribute. No attribution required.
4 · 666 · 4 current installs · 4 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
medium confidence
!
Purpose & Capability
Name/description claim a CLI and a Node library for routing models. The bundle only ships a Bash script (scripts/model-router.sh) and documentation. SKILL.md metadata lists node as a required binary and MODEL_ROUTER_CONFIG as the primary credential, but the script is pure shell and does not use Node or any MODEL_ROUTER_CONFIG environment variable. skill.json lists 'jq' and 'curl' as required binaries (which matches the script's jq check but not the SKILL.md metadata). The presence of a JavaScript usage example (`require('model-router-manager')`) is not backed by any Node package or JS code in the files. These mismatches mean the claimed capabilities are not aligned with what's actually provided.
!
Instruction Scope
The SKILL.md instructs users to run a 'model-router' CLI and shows a Node API, but there is no install spec to place the bash script on PATH or to publish a Node package. The bash script reads/writes config under $HOME/.openclaw (CONFIG_FILE and OPENCLAW_CONFIG) rather than honoring the declared OPENCLAW_CONFIG_PATH env var in the metadata. The instructions do not request unrelated system files or network exfiltration, but they give broad guidance ('ensure API Key is correct') without specifying which env var or config key holds credentials. Overall the runtime instructions grant the agent/installer latitude without matching the shipped implementation.
!
Install Mechanism
No install specification is provided despite the skill including an executable script. That leaves ambiguity about how the 'model-router' command is installed/registered. The skill is instruction-only (no package publish step), so users would need to manually place the script into PATH or otherwise integrate it. This mismatch increases risk/confusion for users installing the skill.
!
Credentials
Declared required env var: OPENCLAW_CONFIG_PATH and primary credential MODEL_ROUTER_CONFIG. The bash script does not read those environment variables; it instead uses hard-coded paths under $HOME/.openclaw. Declaring MODEL_ROUTER_CONFIG (a credential-like primaryEnv) without any usage is disproportionate and unexplained. skill.json's 'requires.binaries' includes jq and curl which is coherent with the script's jq dependency (the script checks jq but not curl). Overall the environment/credential requirements are inconsistent with actual code behavior.
Persistence & Privilege
always is false and the skill does not request system-wide or other-skills' configuration changes. The script reads/writes files under the user's HOME (~/.openclaw), which is expected for a per-user config tool. No autonomous 'always' or elevated persistence is requested.
What to consider before installing
This skill contains plausible functionality (a shell-based model-router CLI), but there are multiple inconsistencies you should resolve before installing: 1) The README and SKILL.md reference a Node API and list node as required, but no Node package or JavaScript files are present — ask the author whether a Node package will be published or remove the Node references. 2) The metadata declares OPENCLAW_CONFIG_PATH and MODEL_ROUTER_CONFIG, but the shipped bash script ignores those env vars and uses hard-coded ~/.openclaw paths — confirm which config path and credential the tool actually uses. 3) There is no install procedure to make the script available as the 'model-router' command; installing may require manual steps. 4) The script requires jq (it checks for jq) and skill.json lists curl; ensure you trust the source and understand where to place the script and how credentials/API keys are stored. If you plan to use this in production or give it access to API keys, ask the maintainer to (a) provide a clear install script or package, (b) reconcile the declared env vars/primary credential with actual runtime use, and (c) publish or remove the Node API example so behavior is explicit. Because of these mismatches, proceed cautiously and avoid providing broad credentials until clarified.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97f6gb1ng97x2f6n05rc7rdh581n04j

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

Runtime requirements

🧭 Clawdis
Binsnode
EnvOPENCLAW_CONFIG_PATH
Primary envMODEL_ROUTER_CONFIG

SKILL.md

Model Router Manager

智能多模型路由管理器 - 告别手动配置,让 AI 自动选择最优模型。

核心功能

功能说明
🔗 模型链配置一键设置主模型 + 多层级备选
⚡ 智能路由按成本/速度/质量自动选择
🔄 故障转移模型失效自动切换,<2秒
📊 成本监控实时统计,超支告警
🎯 策略切换随时切换优化目标

快速开始

1. 配置模型链

# 配置主模型 + 2个备选
model-router config \
  --primary kimi-coding/k2p5 \
  --fallback-1 bailian/qwen3-max-2026-01-23 \
  --fallback-2 openrouter/gpt-4o

2. 选择路由策略

model-router strategy cost    # 最便宜优先
model-router strategy speed   # 最快响应优先
model-router strategy quality # 最佳质量优先

3. 查看统计

model-router stats
# 输出:
# 今日调用:1,234次
# 节省成本:$12.50 (45%)
# 平均延迟:1.2s
# 故障转移:3次

支持的模型

  • Kimi (kimi-coding/k2p5, k2.5, k1.5)
  • 百炼 (bailian/qwen3-max, qwen3-coder, qwen-vl-max)
  • OpenRouter (gpt-4o, claude-3.5-sonnet, etc.)
  • Anthropic (claude-opus-4, claude-sonnet-4)

故障转移逻辑

主模型失败 → 备选1 (1秒内)
备选1失败 → 备选2 (2秒内)
备选2失败 → 本地模型降级

成本对比示例

假设每日 10,000 次调用:

方案日均成本月成本
单用 GPT-4o$125$3,750
单用 Claude$900$27,000
智能路由$50$1,500

节省 60-95%

配置示例

{
  "modelRouter": {
    "strategy": "cost",
    "primary": "kimi-coding/k2p5",
    "fallbacks": [
      "bailian/qwen3-max-2026-01-23",
      "openrouter/gpt-4o"
    ],
    "costLimit": {
      "daily": 10,
      "alertAt": 8
    }
  }
}

命令参考

命令说明
model-router config配置模型链
model-router strategy切换策略
model-router stats查看统计
model-router test测试故障转移
model-router reset重置配置

进阶用法

按任务类型路由

# 代码任务用 Coder 模型
model-router route --task coding --model bailian/qwen3-coder-plus

# 多模态任务用 VL 模型
model-router route --task vision --model bailian/qwen-vl-max

API 集成

const router = require('model-router-manager');

const response = await router.chat({
  message: "你好",
  strategy: "cost",  // 成本优先
  maxCost: 0.01      // 单次最高 $0.01
});

故障排除

Q: 模型切换失败? A: 检查 API Key 和模型名称是否正确。

Q: 成本统计不准确? A: 确保网关版本 >= 2026.2.19

Q: 故障转移太慢? A: 调低 timeout 阈值(默认 5 秒)。

更新日志

v1.0.0 (2026-02-22)

  • 初始发布
  • 支持 3 大模型平台
  • 成本监控功能

作者


🦞 用智能路由,让每一分钱都花在刀刃上。

Files

4 total
Select a file
Select a file to preview.

Comments

Loading comments…