digitaladaption

Model Router

AI 智慧體v1.1.0
作者:digitaladaption更新於 2026-05-17共 2 個版本 · 最新版本釋出於 2026-01-21model-router@clawhub_digitaladaption/model-router
任務自動化工作流編排工具呼叫

據 AlphaMoat 統計,截至 2026-10,Model Router 累計下載 7,683 次、獲 6 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 3,640 位,在「AI 智慧體」分類(1,632 個)中排名第 488 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
7683
星標
6
全站下載量排名
#3,640
全站前 34% · 「AI 智慧體」前 30%
平台累計下載星標評論
ClawHub ↗583552
SkillHub ↗76836—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

主文說明它可對任務分類,並在已配置的多個模型提供商之間路由;選擇因素包括任務型別、複雜度、成本最佳化偏好。設定嚮導用於配置提供商和任務對映,API key 按主文描述儲存在受限許可權檔案中。

資料釋出於 2026-10-27

可以用來做什麼

  • 根據任務型別和複雜度選擇模型
  • 配置多家模型提供商與任務對映

什麼時候用

  • 需要在不同模型之間切換或平衡質量與成本時
  • 首次配置模型提供商、任務分類和偏好時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

根據任務複雜度和成本偏好建議一個已配置模型
說明如何配置模型提供商和任務型別對映

月度資料趨勢

累計下載7683
4440618279232026-05 · 累計下載 46802026-06 · 累計下載 49222026-07 · 累計下載 52912026-08 · 累計下載 56142026-09 · 累計下載 64492026-10 · 累計下載 768326-0526-0926-10
星標6
5672026-05 · 星標 62026-06 · 星標 62026-07 · 星標 62026-08 · 星標 62026-09 · 星標 62026-10 · 星標 626-0526-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。 該技能有同名的其他版本,調整前的資料歸屬當前下載量最大的這一個。

月份累計下載環比星標
2026-107683—6
2026-096449—6
2026-085614+6.1%6
2026-075291+7.5%6
2026-064922+5.2%6
2026-054680—6

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

8.7 KB · ClawHub v1.1.0
---
name: model-router
description: A comprehensive AI model routing system that automatically selects the optimal model for any task. Set up multiple AI providers (Anthropic, OpenAI, Gemini, Moonshot, Z.ai, GLM) with secure API key storage, then route tasks to the best model based on task type, complexity, and cost optimization. Includes interactive setup wizard, task classification, and cost-effective delegation patterns. Use when you need "use X model for this", "switch model", "optimal model", "which model should I use", or to balance quality vs cost across multiple AI providers.
version: 1.1.0
---

# Model Router

**Intelligent AI model routing across multiple providers for optimal cost-performance balance.**
展開全部(共 290 行)
Automatically select the best model for any task based on complexity, type, and your preferences. Support for 6 major AI providers with secure API key management and interactive configuration.

## 🎯 What It Does

- **Analyzes tasks** and classifies them by type (coding, research, creative, simple, etc.)
- **Routes to optimal models** from your configured providers
- **Optimizes costs** by using cheaper models for simple tasks
- **Secures API keys** with file permissions (600) and isolated storage
- **Provides recommendations** with confidence scoring and reasoning

## 🚀 Quick Start

### Step 1: Run the Setup Wizard

```bash
cd skills/model-router
python3 scripts/setup-wizard.py
```

The wizard will guide you through:
1. **Provider setup** - Add your API keys (Anthropic, OpenAI, Gemini, etc.)
2. **Task mappings** - Choose which model for each task type
3. **Preferences** - Set cost optimization level

### Step 2: Use the Classifier

```bash
# Get model recommendation for a task
python3 scripts/classify_task.py "Build a React authentication system"

# Output:
# Recommended Model: claude-sonnet
# Confidence: 85%
# Cost Level: medium
# Reasoning: Matched 2 keywords: build, system
```

### Step 3: Route Tasks with Sessions

```bash
# Spawn with recommended model
sessions_spawn --task "Debug this memory leak" --model claude-sonnet

# Use aliases for quick access
sessions_spawn --task "What's the weather?" --model haiku
```

## 📊 Supported Providers

| Provider | Models | Best For | Key Format |
|----------|--------|----------|------------|
| **Anthropic** | claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5 | Coding, reasoning, creative | `sk-ant-...` |
| **OpenAI** | gpt-4o, gpt-4o-mini, o1-mini, o1-preview | Tools, deep reasoning | `sk-proj-...` |
| **Gemini** | gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash | Multimodal, huge context (2M) | `AIza...` |
| **Moonshot** | moonshot-v1-8k/32k/128k | Chinese language | `sk-...` |
| **Z.ai** | glm-4.5-air, glm-4.7 | Cheapest, fast | Various |
| **GLM** | glm-4-flash, glm-4-plus, glm-4-0520 | Chinese, coding | `ID.secret` |

## 🎛️ Task Type Mappings

Default routing (customizable via wizard):

| Task Type | Default Model | Why |
|-----------|---------------|-----|
| `simple` | glm-4.5-air | Fastest, cheapest for quick queries |
| `coding` | claude-sonnet-4-5 | Excellent code understanding |
| `research` | claude-sonnet-4-5 | Balanced depth and speed |
| `creative` | claude-opus-4-5 | Maximum creativity |
| `math` | o1-mini | Specialized reasoning |
| `vision` | gemini-1.5-flash | Fast multimodal |
| `chinese` | glm-4.7 | Optimized for Chinese |
| `long_context` | gemini-1.5-pro | Up to 2M tokens |

## 💰 Cost Optimization

### Aggressive Mode
Always uses the cheapest capable model:
- Simple → glm-4.5-air (~10% cost)
- Coding → claude-haiku-4-5 (~25% cost)
- Research → claude-sonnet-4-5 (~50% cost)

**Savings:** 50-90% compared to always using premium models

### Balanced Mode (Default)
Considers cost vs quality:
- Simple tasks → Cheap models
- Critical tasks → Premium models
- Automatic escalation if cheap model fails

### Quality Mode
Always uses the best model regardless of cost

## 🔒 Security

### API Key Storage
```
~/.model-router/
├── config.json       # Model mappings (chmod 600)
└── .api-keys         # API keys (chmod 600)
```

**Features:**
- File permissions restricted to owner (600)
- Isolated from version control
- Encrypted at rest (via OS filesystem encryption)
- Never logged or printed

### Best Practices
1. **Never commit** `.api-keys` to version control
2. **Use environment variables** for production deployments
3. **Rotate keys** regularly via the wizard
4. **Audit access** with `ls -la ~/.model-router/`

## 📖 Usage Examples

### Example 1: Cost-Optimized Workflow

```bash
# Classify task first
python3 scripts/classify_task.py "Extract prices from this CSV"

# Result: simple task → use glm-4.5-air
sessions_spawn --task "Extract prices" --model glm-4.5-air

# Then analyze with better model if needed
sessions_spawn --task "Analyze price trends" --model claude-sonnet
```

### Example 2: Progressive Escalation

```bash
# Try cheap model first (60s timeout)
sessions_spawn --task "Fix this bug" --model glm-4.5-air --runTimeoutSeconds 60

# If fails, escalate to premium
sessions_spawn --task "Fix complex architecture bug" --model claude-opus
```

### Example 3: Parallel Processing

```bash
# Batch simple tasks in parallel with cheap model
sessions_spawn --task "Summarize doc A" --model glm-4.5-air &
sessions_spawn --task "Summarize doc B" --model glm-4.5-air &
sessions_spawn --task "Summarize doc C" --model glm-4.5-air &
wait
```

### Example 4: Multimodal with Gemini

```bash
# Vision task with 2M token context
sessions_spawn --task "Analyze these 100 images" --model gemini-1.5-pro
```

## 🛠️ Configuration Files

### `~/.model-router/config.json`
```json
{
  "version": "1.1.0",
  "providers": {
    "anthropic": {
      "configured": true,
      "models": ["claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-4-5"]
    },
    "openai": {
      "configured": true,
      "models": ["gpt-4o", "gpt-4o-mini", "o1-mini", "o1-preview"]
    }
  },
  "task_mappings": {
    "simple": "glm-4.5-air",
    "coding": "claude-sonnet-4-5",
    "research": "claude-sonnet-4-5",
    "creative": "claude-opus-4-5"
  },
  "preferences": {
    "cost_optimization": "balanced",
    "default_provider": "anthropic"
  }
}
```

### `~/.model-router/.api-keys`
```bash
# Generated by setup wizard - DO NOT edit manually
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-proj-...
GEMINI_API_KEY=AIza...
```

## 🔄 Version 1.1 Changes

### New Features
- ✅ **Interactive setup wizard** for guided configuration
- ✅ **Secure API key storage** with file permissions
- ✅ **Task-to-model mapping** customization
- ✅ **Multi-provider support** (6 providers)
- ✅ **Cost optimization levels** (aggressive/balanced/quality)

### Improvements
- ✅ Better task classification with confidence scores
- ✅ Provider-specific model recommendations
- ✅ Enhanced security with isolated storage
- ✅ Comprehensive documentation

### Migration from 1.0
Run the setup wizard to reconfigure:
```bash
python3 scripts/setup-wizard.py
```

## 📚 Command Reference

### Setup Wizard
```bash
python3 scripts/setup-wizard.py
```
Interactive configuration of providers, mappings, and preferences.

### Task Classifier
```bash
python3 scripts/classify_task.py "your task description"
python3 scripts/classify_task.py "your task" --format json
```
Get model recommendation with reasoning.

### List Models
```bash
python3 scripts/setup-wizard.py --list
```
Show all available models and their status.

## 🤝 Integration with Other Skills

| Skill | Integration |
|-------|-------------|
| **model-usage** | Track cost per provider to optimize routing |
| **sessions_spawn** | Primary tool for model delegation |
| **session_status** | Check current model and usage |

## ⚡ Performance Tips

1. **Start simple** - Try cheap models first
2. **Batch tasks** - Combine multiple simple tasks
3. **Use cleanup** - Delete sessions after one-off tasks
4. **Set timeouts** - Prevent runaway sub-agents
5. **Monitor usage** - Track costs per provider

## 🐛 Troubleshooting

### "No suitable model found"
- Run setup wizard to configure providers
- Check API keys are valid
- Verify permissions on `.api-keys` file

### "Module not found"
```bash
pip3 install -r requirements.txt  # if needed
```

### Wrong model selected
1. Customize task mappings via wizard
2. Use explicit model in `sessions_spawn --model`
3. Adjust cost optimization preference

## 📖 Additional Resources

- **Provider Docs:**
  - [Anthropic](https://docs.anthropic.com)
  - [OpenAI](https://platform.openai.com/docs)
  - [Gemini](https://ai.google.dev/docs)
  - [Moonshot](https://platform.moonshot.cn/docs)
  - [Z.ai](https://api.z.ai/docs)
  - [GLM](https://open.bigmodel.cn/dev/api)

- **Setup:** Run `python3 scripts/setup-wizard.py`
- **Support:** Check `references/` folder for detailed guides

「AI 智慧體」分類下的熱門技能

digitaladaption 的其他技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。