Model Router
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 sto
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 sto
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
Intelligent AI model routing across multiple providers for optimal cost-performance balance.
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.
cd skills/model-router python3 scripts/setup-wizard.py
The wizard will guide you through:
# 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
# Spawn with recommended model sessions_spawn --task "Debug this memory leak" --model claude-sonnetUse aliases for quick access
sessions_spawn --task "What's the weather?" --model haiku
| Provider | Models | Best For | Key Format |
|---|---|---|---|
| Anthropic | claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5 | Coding, reasoning, creative | |
| OpenAI | gpt-4o, gpt-4o-mini, o1-mini, o1-preview | Tools, deep reasoning | |
| Gemini | gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash | Multimodal, huge context (2M) | |
| Moonshot | moonshot-v1-8k/32k/128k | Chinese language | |
| Z.ai | glm-4.5-air, glm-4.7 | Cheapest, fast | Various |
| GLM | glm-4-flash, glm-4-plus, glm-4-0520 | Chinese, coding | |
Default routing (customizable via wizard):
| Task Type | Default Model | Why |
|---|---|---|
| glm-4.5-air | Fastest, cheapest for quick queries |
| claude-sonnet-4-5 | Excellent code understanding |
| claude-sonnet-4-5 | Balanced depth and speed |
| claude-opus-4-5 | Maximum creativity |
| o1-mini | Specialized reasoning |
| gemini-1.5-flash | Fast multimodal |
| glm-4.7 | Optimized for Chinese |
| gemini-1.5-pro | Up to 2M tokens |
Always uses the cheapest capable model:
Savings: 50-90% compared to always using premium models
Considers cost vs quality:
Always uses the best model regardless of cost
~/.model-router/ ├── config.json # Model mappings (chmod 600) └── .api-keys # API keys (chmod 600)
Features:
.api-keys to version controlls -la ~/.model-router/# 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
# Try cheap model first (60s timeout) sessions_spawn --task "Fix this bug" --model glm-4.5-air --runTimeoutSeconds 60If fails, escalate to premium
sessions_spawn --task "Fix complex architecture bug" --model claude-opus
# 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
# Vision task with 2M token context sessions_spawn --task "Analyze these 100 images" --model gemini-1.5-pro
~/.model-router/config.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# Generated by setup wizard - DO NOT edit manually ANTHROPIC_API_KEY=sk-ant-... OPENAI_API_KEY=sk-proj-... GEMINI_API_KEY=AIza...
Run the setup wizard to reconfigure:
python3 scripts/setup-wizard.py
python3 scripts/setup-wizard.py
Interactive configuration of providers, mappings, and preferences.
python3 scripts/classify_task.py "your task description" python3 scripts/classify_task.py "your task" --format json
Get model recommendation with reasoning.
python3 scripts/setup-wizard.py --list
Show all available models and their status.
| 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 |
.api-keys filepip3 install -r requirements.txt # if needed
sessions_spawn --modelNo automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.