← 返回
AI智能 中文

Ai Model Router V2

Automatically routes requests between local and cloud AI models based on task complexity and privacy, with auto-detection and context tracking.
根据任务复杂度和隐私性,自动在本地与云端AI模型间路由请求,具备自动检测与上下文追踪功能。
yuldrone
AI智能 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 599
下载
💾 8
安装
1
版本
#latest

概述

AI Model Router

Compact, intelligent model routing that just works.

Quick Start

# 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)

PatternPoints
-----------------
Microservices, architecture+10
Design, implement, optimize+5
Explain, analyze, compare+3
Syntax, example, "what is"-3

Threshold: 5 (simple vs complex)

Features

FeatureStatus
-----------------
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

# 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

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:

{
  "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)

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-30 05:12 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Proactive Agent

halthelobster
将AI智能体从任务执行者升级为主动预判需求、持续优化的智能伙伴。集成WAL协议、工作缓冲区、自主定时任务及实战验证模式。Hal Stack核心组件 🦞
★ 836 📥 213,189
ai-intelligence

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 418 📥 115,240
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,358 📥 318,474