Expertise-aware model router with semantic domain scoring, context-overflow protection, and security redaction. Automatically selects the optimal AI model using weighted expertise scoring (Feb 2026 benchmarks). Supports Claude, GPT, Gemini, Grok with automatic fallback chains, HITL gates, and cost optimization.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install smart-router或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install smart-router⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/smart-router/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: smart-router description: > Expertise-aware model router with semantic domain scoring, context-overflow protection, and security redaction. Automatically selects the optimal AI model using weighted expertise scoring (Feb 2026 benchmarks). Supports Claude, GPT, Gemini, Grok with automatic fallback chains, HITL gates, and cost optimization. author: c0nSpIc0uS7uRk3r version: 2.1.0 license: MIT metadata: openclaw: requires: bins: ["python3"] env: ["ANTHROPIC_API_KEY"] optional_env: ["GOOGLE_API_KEY", "OPENAI_API_KEY", "XAI_API_KEY"] features: - Semantic domain detection - Expertise-weighted scoring (0-100) - Risk-based mandatory routing - Context overflow protection (>150K → Gemini) - Security credential redaction - Circuit breaker with persistent state - HITL gate for low-confidence routing benchmarks: source: "Feb 2026 MLOC Analysis" models: - "Claude Opus 4.5: SWE-bench 80.9%" - "GPT-5.2: AIME 100%, Control Flow 22 errors/MLOC" - "Gemini 3 Pro: Concurrency 69 issues/MLOC" ---
Intelligently route requests to the optimal AI model using tiered classification with automatic fallback handling and cost optimization.
The router operates transparently—users send messages normally and get responses from the best model for their task. No special commands needed.
Optional visibility: Include [show routing] in any message to see the routing decision.
The router uses a three-tier decision process:
┌─────────────────────────────────────────────────────────────────┐
│ TIER 1: INTENT DETECTION │
│ Classify the primary purpose of the request │
├─────────────────────────────────────────────────────────────────┤
│ CODE │ ANALYSIS │ CREATIVE │ REALTIME │ GENERAL │
│ write/debug │ research │ writing │ news/live │ Q&A/chat │
│ refactor │ explain │ stories │ X/Twitter │ translate │
│ review │ compare │ brainstorm │ prices │ summarize │
└──────┬───────┴──────┬──────┴─────┬──────┴─────┬─────┴─────┬─────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ TIER 2: COMPLEXITY ESTIMATION │
├─────────────────────────────────────────────────────────────────┤
│ SIMPLE (Tier $) │ MEDIUM (Tier $$) │ COMPLEX (Tier $$$)│
│ • One-step task │ • Multi-step task │ • Deep reasoning │
│ • Short response OK │ • Some nuance │ • Extensive output│
│ • Factual lookup │ • Moderate context │ • Critical task │
│ → Haiku/Flash │ → Sonnet/Grok/GPT │ → Opus/GPT-5 │
└──────────────────────────┴─────────────────────┴───────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ TIER 3: SPECIAL CASE OVERRIDES │
├─────────────────────────────────────────────────────────────────┤
│ CONDITION │ OVERRIDE TO │
│ ─────────────────────────────────────┼─────────────────────────│
│ Context >100K tokens │ → Gemini Pro (1M ctx) │
│ Context >500K tokens │ → Gemini Pro ONLY │
│ Needs real-time data │ → Grok (regardless) │
│ Image/vision input │ → Opus or Gemini Pro │
│ User explicit override │ → Requested model │
└──────────────────────────────────────┴──────────────────────────┘
When a request contains multiple clear intents (e.g., "Write code to analyze this data and explain it creatively"):
Examples:
Non-English requests are handled normally — all supported models have multilingual capabilities:
| Model | Non-English Support | |-------|---------------------| | Opus/Sonnet/Haiku | Excellent (100+ languages) | | GPT-5 | Excellent (100+ languages) | | Gemini Pro/Flash | Excellent (100+ languages) | | Grok | Good (major languages) |
Intent detection still works because:
Edge case: If intent unclear due to language, default to GENERAL intent with MEDIUM complexity.
| Intent | Simple | Medium | Complex | |--------|--------|--------|---------| | CODE | Sonnet | Opus | Opus | | ANALYSIS | Flash | GPT-5 | Opus | | CREATIVE | Sonnet | Opus | Opus | | REALTIME | Grok | Grok | Grok-3 | | GENERAL | Flash | Sonnet | Opus |
When a model becomes unavailable mid-session (token quota exhausted, rate limit hit, API error), the router automatically switches to the next best available model and notifies the user.
When a model switch occurs due to exhaustion, the user receives a notification:
┌─────────────────────────────────────────────────────────────────┐
│ ⚠️ MODEL SWITCH NOTICE │
│ │
│ Your request could not be completed on claude-opus-4-5 │
│ (reason: token quota exhausted). │
│ │
│ ✅ Request completed using: anthropic/claude-sonnet-4-5 │
│ │
│ The response below was generated by the fallback model. │
└─────────────────────────────────────────────────────────────────┘
...
安装 A.I. Smart Router 后,可以对 AI 说这些话来触发它
Help me get started with A.I. Smart Router
Explains what A.I. Smart Router does, walks through the setup, and runs a quick demo based on your current project
Use A.I. Smart Router to expertise-aware model router with semantic domain scoring, context-...
Invokes A.I. Smart Router with the right parameters and returns the result directly in the conversation
What can I do with A.I. Smart Router in my developer & devops workflow?
Lists the top use cases for A.I. Smart Router, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/smart-router/ 目录(个人级,所有项目可用),或 .claude/skills/smart-router/(项目级)。重启 AI 客户端后,用 /smart-router 主动调用,或让 AI 根据上下文自动发现并使用。
A.I. Smart Router 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
A.I. Smart Router 可免费安装使用。请查阅仓库了解许可证信息。
Expertise-aware model router with semantic domain scoring, context-overflow protection, and security redaction. Automatically selects the optimal AI model using weighted expertise scoring (Feb 2026 benchmarks). Supports Claude, GPT, Gemini, Grok with automatic fallback chains, HITL gates, and cost optimization.
A.I. Smart Router 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using A.I. Smart Router
Identifies repetitive steps in your workflow and sets up A.I. Smart Router to handle them automatically