model-routerA 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.
Install via ClawdBot CLI:
clawdbot install digitaladaption/model-routerIntelligent 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-sonnet
# Use 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 | 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 |
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 |
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 60
# If 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 --modelpython3 scripts/setup-wizard.pyreferences/ folder for detailed guidesGenerated Mar 1, 2026
Agencies can use the Model Router to optimize costs across client projects by routing simple debugging tasks to cheaper models like glm-4.5-air and complex architecture design to premium models like claude-opus-4-5. This reduces operational expenses while maintaining high-quality outputs for critical coding and research tasks.
Research teams can leverage the skill to handle diverse tasks, such as routing literature reviews to claude-sonnet-4-5 for balanced analysis and mathematical proofs to o1-mini for specialized reasoning. The cost optimization modes help manage limited grant budgets by using aggressive settings for preliminary analyses.
Support teams can automate responses by routing simple FAQ queries to fast, cheap models like glm-4.5-air and escalate complex customer issues to models like claude-sonnet-4-5 for nuanced problem-solving. This improves response times and reduces costs while handling high volumes of inquiries.
Studios can use the router for creative workflows, directing brainstorming tasks to claude-opus-4-5 for maximum creativity and routine content summarization to gemini-1.5-flash for multimodal efficiency. The task classification ensures optimal model selection for both quality and speed in production pipelines.
Companies operating in Chinese markets can route language-specific tasks to optimized models like glm-4.7, while using other providers for global operations. This ensures accurate localization and cost savings by matching task types to the most effective models across different regions.
Offer the Model Router as a cloud-based service with tiered pricing based on usage volume and optimization modes. Revenue comes from monthly subscriptions, with premium tiers providing advanced features like custom task mappings and priority support for enterprise clients.
Provide consulting services to help businesses integrate the skill into their existing AI workflows, including custom configuration and training. Revenue is generated through project-based fees and ongoing maintenance contracts for optimizing model routing strategies.
License the Model Router technology to other AI platforms or enterprises for embedding into their products. Revenue comes from licensing fees and royalties based on user adoption, allowing partners to enhance their offerings with intelligent model routing capabilities.
š¬ Integration Tip
Start with the interactive setup wizard to configure providers and task mappings easily, then use the classifier script for initial recommendations before full integration into workflows.
Use CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Gemini CLI for one-shot Q&A, summaries, and generation.
Research any topic from the last 30 days on Reddit + X + Web, synthesize findings, and write copy-paste-ready prompts. Use when the user wants recent social/web research on a topic, asks "what are people saying about X", or wants to learn current best practices. Requires OPENAI_API_KEY and/or XAI_API_KEY for full Reddit+X access, falls back to web search.
Check Antigravity account quotas for Claude and Gemini models. Shows remaining quota and reset times with ban detection.
Manages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates opencla...
Manages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates openclaw.json. Use when the user mentions free AI, OpenRouter, model switching, rate limits, or wants to reduce AI costs.