返回顶部
a

ai-model-routerAI模型路由

Intelligent AI model router that automatically switches between two configured models (local for simple tasks, cloud for complex ones). Detects local models (Ollama, LM Studio) automatically, routes based on task complexity and privacy. Use when users ask to "switch model", "use local/cloud model", or mention API keys/passwords (triggers privacy mode). Trigger on: sensitive data detection (forces local), complex tasks like "design architecture" (uses cloud), or configuration requests.

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

ai-model-router

AI Model Router

紧凑、智能的模型路由,开箱即用。

快速开始

bash

安装


npx clawhub@latest install ai-model-router

首次运行 - 自动检测您的模型

python3 skill/core/router.py 什么是Python?

列出可用模型

python3 skill/core/router.py --list

工作原理

您的请求 → 分析 → 选择模型

简单?→ 主模型(快速/低成本)
复杂?→ 备选模型(功能强大)
隐私?→ 主模型(强制)

评分(来自 model-router-premium)

模式分值
微服务、架构+10
设计、实现、优化
+5 | | 解释、分析、比较 | +3 | | 语法、示例、什么是 | -3 |

阈值:5(简单 vs 复杂)

功能特性

功能状态
自动检测本地模型✓ (Ollama, LM Studio)
云端模型注册表
✓ (7个内置) | | 隐私检测 | ✓ (API密钥、密码) | | 上下文追踪 | ✓ (对话) | | JSON配置 | ✓ (可选) | | CLI界面 | ✓ | | 核心代码量 | 约200行 |

CLI

bash

路由任务


python3 skill/core/router.py 设计一个系统
python3 skill/core/router.py 什么是for循环?

选项

--json # JSON输出 --force primary # 强制使用主模型 --list # 列出所有模型 --status # 显示状态

Python API

python
from skill.core.router import RouterCore

router = RouterCore()
result = router.route(设计微服务)

print(result.model_name) # Claude Opus 4
print(result.reason) # complex_task(score=15)
print(result.confidence) # 0.75

配置(可选)

创建 ~/.model-router/models.json:

json
{
primary_model: {id: ollama:llama3:8b},
secondary_model: {id: anthropic:claude-opus-4},
models: [...]
}

无配置时:自动检测本地模型并使用云端注册表。

隐私保护

检测到敏感数据时自动强制使用主模型(本地):

  • - API密钥(sk-...、api_key)
  • 密码(password、passwd)
  • 令牌(bearer、secret)
  • 电子邮件、社保号、信用卡

文件

  • - core/router.py - 核心路由引擎(约200行)
  • modules/detector.py - 自动检测(可选)
  • modules/context.py - 上下文追踪(可选)

灵感来源

  • - model-router-premium:简单评分逻辑,成本感知路由
  • Model Router v1:完整功能集,文档完善

本版本融合了:

  • - model-router-premium的简洁性(约200行)
  • ai-model-router的功能特性(隐私保护、自动检测、上下文追踪)

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ai-model-router-1776064922 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ai-model-router-1776064922 技能

通过命令行安装

skillhub install ai-model-router-1776064922

下载

⬇ 下载 ai-model-router v2.0.0(免费)

文件大小: 8.89 KB | 发布时间: 2026-4-14 16:01

v2.0.0 最新 2026-4-14 16:01
No changes detected in this release.

- Version number and documentation remain unchanged.
- No file or feature updates.

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

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

p2p_official_large
返回顶部