返回顶部
a

ai-model-router

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
安全检测
已通过
274
下载量
0
收藏
概述
安装方式
版本历史

ai-model-router

# AI Model Router Compact, intelligent model routing that just works. ## Quick Start ```bash # Install npx clawhub@latest install ai-model-router # First run - auto-detects your models python3 skill/core/router.py "What is Python?" # List available models python3 skill/core/router.py --list ``` ## How It Works ``` Your Request → Analyze → Select Model ↓ Simple? → Primary (fast/cheap) Complex? → Secondary (capable) Private? → Primary (forced) ``` ## Scoring (from model-router-premium) | Pattern | Points | |---------|--------| | Microservices, architecture | +10 | | Design, implement, optimize | +5 | | Explain, analyze, compare | +3 | | **Syntax, example, "what is"** | **-3** | **Threshold: 5** (simple vs complex) ## Features | Feature | Status | |---------|--------| | Auto-detect local models | ✓ (Ollama, LM Studio) | | Cloud model registry | ✓ (7 built-in) | | Privacy detection | ✓ (API keys, passwords) | | Context tracking | ✓ (conversations) | | JSON config | ✓ (optional) | | CLI interface | ✓ | | **Core code size** | **~200 lines** | ## CLI ```bash # Route a task python3 skill/core/router.py "Design a system" python3 skill/core/router.py "What is a for loop?" # Options --json # JSON output --force primary # Force primary model --list # List all models --status # Show status ``` ## Python API ```python from skill.core.router import RouterCore router = RouterCore() result = router.route("Design microservices") print(result.model_name) # "Claude Opus 4" print(result.reason) # "complex_task(score=15)" print(result.confidence) # 0.75 ``` ## Configuration (Optional) Create `~/.model-router/models.json`: ```json { "primary_model": {"id": "ollama:llama3:8b"}, "secondary_model": {"id": "anthropic:claude-opus-4"}, "models": [...] } ``` **Without config**: Auto-detects local + uses cloud registry. ## Privacy Protection Automatically forces primary (local) when sensitive data detected: - API keys (`sk-...`, `api_key`) - Passwords (`password`, `passwd`) - Tokens (`bearer`, `secret`) - Emails, SSN, credit cards ## Files - `core/router.py` - Core routing engine (~200 lines) - `modules/detector.py` - Auto-detection (optional) - `modules/context.py` - Context tracking (optional) ## Inspired By - **model-router-premium**: Simple scoring logic, cost-aware routing - **Model Router v1**: Full feature set, documentation This version combines: - The **simplicity** of model-router-premium (~200 lines) - The **features** of ai-model-router (privacy, auto-detect, context)

标签

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

下载 Zip 包

⬇ 下载 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
返回顶部