smart-model-switching
Auto-route tasks to the cheapest Claude model that works correctly. Three-tier progression: Haiku → Sonnet → Opus. Classify before responding. HAIKU (default): factual Q&A, greetings, reminders, status checks, lookups, simple file ops, heartbeats, casual chat, 1-2 sentence tasks. ESCALATE TO SONNET: code >10 lines, analysis, comparisons, planning, reports, multi-step reasoning, tables, long writing >3 paragraphs, summarization, research synthesis, most user conversations. ESCALATE TO OPUS: architecture decisions, complex debugging, multi-file refactoring, strategic planning, nuanced judgment, deep research, critical production decisions. Rule: If a human needs >30 seconds of focused thinking, escalate. If Sonnet struggles with complexity, go to Opus. Save 50-90% on API costs by starting cheap and escalating only when needed.
Why use this skill?
Optimize OpenClaw agent costs with smart-model-switching. Automatically route tasks between Claude Haiku, Sonnet, and Opus to save up to 90% on API costs.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/millibus/smart-model-switchingWhat This Skill Does
The smart-model-switching skill introduces a tiered intelligence routing system for the OpenClaw agent. By automatically classifying tasks before execution, it assigns them to the most efficient Claude model—Haiku, Sonnet, or Opus. This strategic allocation ensures that simple tasks remain low-cost, while complex problems receive the full reasoning power of premium models, ultimately reducing API expenses by 50-90% without compromising on quality.
Installation
To install this skill, use the OpenClaw command-line interface:
clawhub install openclaw/skills/skills/millibus/smart-model-switching
Once installed, the skill acts as a middleware router for all incoming requests, evaluating complexity thresholds before initiating a subagent or task session.
Use Cases
- Routine Operations: Use Haiku for status checks, file reads, and heartbeat responses.
- Technical Development: Use Sonnet for writing features, code reviews, and project planning tasks that involve multi-step reasoning.
- Strategic Architecture: Use Opus for system design, deep architectural shifts, or debugging complex, multi-file concurrency issues.
Example Prompts
- "What is the current status of the database backup?" (Haiku)
- "Please review this 50-line Python script and suggest improvements for better memory efficiency." (Sonnet)
- "We need a complete system architecture overhaul to support microservices; analyze the trade-offs between our current monolithic approach and a service-oriented model." (Opus)
Tips & Limitations
- The 30-Second Rule: As a rule of thumb, if a human would require more than 30 seconds of focused, deep thought to solve the problem, escalate immediately to Sonnet or Opus.
- Cost Awareness: Always prioritize Haiku for simple, repetitive tasks to keep your monthly token budget lean.
- Escalation Loop: If a task assigned to Sonnet is returning suboptimal results or struggling with ambiguity, trigger a re-classification to upgrade to Opus.
- Constraint: Be aware that forced model locking can occasionally lead to sub-optimal cost-to-performance ratios if not monitored correctly; allow the classifier to operate freely for the best results.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-millibus-smart-model-switching": {
"enabled": true,
"auto_update": true
}
}
}