Smart Model Switching
Three-tier Claude routing: Haiku → Sonnet → Opus
Start with the cheapest model. Escalate only when needed. Save 50-90% on API costs.
The Golden Rule
If a human would need more than 30 seconds of focused thinking, escalate from Haiku to Sonnet.
If the task involves architecture, complex tradeoffs, or deep reasoning, escalate to Opus.
Cost Reality
| Model | Input | Output | Relative Cost |
|---|
| Haiku | \$0.25/M | \$1.25/M | 1x (baseline) |
| Sonnet |
\$3.00/M | \$15.00/M | 12x |
| Opus | \$15.00/M | \$75.00/M | 60x |
Bottom line: Wrong model selection wastes money OR time. Haiku for simple, Sonnet for standard, Opus for complex.
💚 HAIKU — Default for Simple Tasks
Stay on Haiku for:
- - Factual Q&A — "what is X", "who is Y", "when did Z"
- Quick lookups — definitions, unit conversions, short translations
- Status checks — calendar, file reads, session monitoring
- Heartbeats — periodic checks, HEARTBEAT_OK responses
- Memory & reminders — "remember this", "remind me to..."
- Casual conversation — greetings, small talk, acknowledgments
- Simple file ops — read, list, basic writes
- One-liner tasks — anything answerable in 1-2 sentences
NEVER do these on Haiku
- - ❌ Write code longer than 10 lines
- ❌ Create comparison tables
- ❌ Write more than 3 paragraphs
- ❌ Do multi-step analysis
- ❌ Write reports or proposals
💛 SONNET — Standard Work (The Workhorse)
Escalate to Sonnet for:
Code & Technical
- - Code generation — write functions, build features, scripts
- Code review — PR reviews, quality checks
- Debugging — standard bug investigation
- Documentation — README, comments, user guides
Analysis & Planning
- - Analysis & evaluation — compare options, assess trade-offs
- Planning — project plans, roadmaps, task breakdowns
- Research synthesis — combining multiple sources
- Multi-step reasoning — "first... then... finally"
Writing & Content
- - Long-form writing — reports, proposals, articles (>3 paragraphs)
- Creative writing — blog posts, descriptions, copy
- Summarization — long documents, transcripts
- Structured output — tables, outlines, formatted docs
❤️ OPUS — Complex Reasoning Only
Escalate to Opus for:
Architecture & Design
- - System architecture decisions
- Major codebase refactoring
- Design pattern selection with tradeoffs
- Database schema design
Deep Analysis
- - Complex debugging (multi-file, race conditions)
- Security reviews
- Performance optimization strategy
- Root cause analysis of subtle bugs
Strategic & Creative
- - Strategic planning — business decisions, roadmaps
- Nuanced judgment — ethics, ambiguity, competing values
- Deep research — comprehensive multi-source analysis
🔄 Implementation
For Subagents
\
\\
javascript
// Routine monitoring
sessions_spawn(task="Check backup status", model="haiku")
// Standard code work
sessions_spawn(task="Build the REST API endpoint", model="sonnet")
// Architecture decisions
sessions_spawn(task="Design the database schema for multi-tenancy", model="opus")
\\ INLINECODE2
For Cron Jobs
\
\\
json
{
"payload": {
"kind": "agentTurn",
"model": "haiku"
}
}
\\
\
Always use Haiku for cron unless the task genuinely needs reasoning.
📊 Quick Decision Tree
\\\
Is it a greeting, lookup, status check, or 1-2 sentence answer?
YES → HAIKU
NO ↓
Is it code, analysis, planning, writing, or multi-step?
YES → SONNET
NO ↓
Is it architecture, deep reasoning, or critical decision?
YES → OPUS
NO → Default to SONNET, escalate if struggling
\\\
📋 Quick Reference Card
\\\
┌─────────────────────────────────────────────────────────────┐
│ SMART MODEL SWITCHING │
│ Haiku → Sonnet → Opus │
├─────────────────────────────────────────────────────────────┤
│ 💚 HAIKU (cheapest) │
│ • Greetings, status checks, quick lookups │
│ • Factual Q&A, definitions, reminders │
│ • Simple file ops, 1-2 sentence answers │
├─────────────────────────────────────────────────────────────┤
│ 💛 SONNET (standard) │
│ • Code > 10 lines, debugging │
│ • Analysis, comparisons, planning │
│ • Reports, proposals, long writing │
├─────────────────────────────────────────────────────────────┤
│ ❤️ OPUS (complex) │
│ • Architecture decisions │
│ • Complex debugging, multi-file refactoring │
│ • Strategic planning, deep research │
├─────────────────────────────────────────────────────────────┤
│ 💡 RULE: If a human needs > 30 sec thinking → escalate │
│ 💰 COST: Haiku 1x → Sonnet 12x → Opus 60x │
└─────────────────────────────────────────────────────────────┘
\\\
Built for Claude-only setups with Haiku, Sonnet, and Opus.
Inspired by save-money skill, extended with three-tier progression.
智能模型切换
三层Claude路由:Haiku → Sonnet → Opus
从最便宜的模型开始。仅在需要时升级。节省50-90%的API成本。
黄金法则
如果人类需要超过30秒的专注思考,从Haiku升级到Sonnet。
如果任务涉及架构、复杂权衡或深度推理,升级到Opus。
成本现实
| 模型 | 输入 | 输出 | 相对成本 |
|---|
| Haiku | 0.25美元/百万 | 1.25美元/百万 | 1倍(基准) |
| Sonnet |
3.00美元/百万 | 15.00美元/百万 | 12倍 |
| Opus | 15.00美元/百万 | 75.00美元/百万 | 60倍 |
核心要点: 错误的模型选择要么浪费金钱,要么浪费时间。Haiku用于简单任务,Sonnet用于标准任务,Opus用于复杂任务。
💚 HAIKU — 简单任务的默认选择
以下情况保持使用Haiku:
- - 事实问答 — X是什么、Y是谁、Z什么时候
- 快速查询 — 定义、单位换算、简短翻译
- 状态检查 — 日历、文件读取、会话监控
- 心跳检测 — 定期检查、HEARTBEAT_OK响应
- 记忆与提醒 — 记住这个、提醒我...
- 日常对话 — 问候、闲聊、确认回复
- 简单文件操作 — 读取、列表、基本写入
- 单行任务 — 任何1-2句话能回答的问题
绝不在Haiku上执行的操作
- - ❌ 编写超过10行的代码
- ❌ 创建对比表格
- ❌ 撰写超过3段的内容
- ❌ 进行多步骤分析
- ❌ 编写报告或提案
💛 SONNET — 标准工作(主力模型)
以下情况升级到Sonnet:
代码与技术
- - 代码生成 — 编写函数、构建功能、脚本
- 代码审查 — PR审查、质量检查
- 调试 — 标准bug调查
- 文档 — README、注释、用户指南
分析与规划
- - 分析与评估 — 比较选项、评估权衡
- 规划 — 项目计划、路线图、任务分解
- 研究综合 — 整合多个来源
- 多步骤推理 — 首先...然后...最后
写作与内容
- - 长文写作 — 报告、提案、文章(超过3段)
- 创意写作 — 博客文章、描述、文案
- 摘要 — 长文档、转录文本
- 结构化输出 — 表格、大纲、格式化文档
❤️ OPUS — 仅用于复杂推理
以下情况升级到Opus:
架构与设计
- - 系统架构决策
- 主要代码库重构
- 设计模式选择及权衡
- 数据库模式设计
深度分析
- - 复杂调试(多文件、竞态条件)
- 安全审查
- 性能优化策略
- 细微bug的根因分析
战略与创意
- - 战略规划 — 商业决策、路线图
- 细致判断 — 伦理、模糊性、价值冲突
- 深度研究 — 全面的多来源分析
🔄 实现方式
子代理
\\\javascript
// 常规监控
sessions_spawn(task=检查备份状态, model=haiku)
// 标准代码工作
sessions_spawn(task=构建REST API端点, model=sonnet)
// 架构决策
sessions_spawn(task=设计多租户数据库模式, model=opus)
\\\
定时任务
\\\json
{
payload: {
kind: agentTurn,
model: haiku
}
}
\\\
除非任务确实需要推理,否则始终对定时任务使用Haiku。
📊 快速决策树
\\\
是问候、查询、状态检查或1-2句话回答?
是 → HAIKU
否 ↓
是代码、分析、规划、写作或多步骤任务?
是 → SONNET
否 ↓
是架构、深度推理或关键决策?
是 → OPUS
否 → 默认使用SONNET,遇到困难时升级
\\\
📋 快速参考卡
\\\
┌─────────────────────────────────────────────────────────────┐
│ 智能模型切换 │
│ Haiku → Sonnet → Opus │
├─────────────────────────────────────────────────────────────┤
│ 💚 HAIKU(最便宜) │
│ • 问候、状态检查、快速查询 │
│ • 事实问答、定义、提醒 │
│ • 简单文件操作、1-2句话回答 │
├─────────────────────────────────────────────────────────────┤
│ 💛 SONNET(标准) │
│ • 超过10行的代码、调试 │
│ • 分析、比较、规划 │
│ • 报告、提案、长文写作 │
├─────────────────────────────────────────────────────────────┤
│ ❤️ OPUS(复杂) │
│ • 架构决策 │
│ • 复杂调试、多文件重构 │
│ • 战略规划、深度研究 │
├─────────────────────────────────────────────────────────────┤
│ 💡 规则:如果人类需要>30秒思考 → 升级 │
│ 💰 成本:Haiku 1倍 → Sonnet 12倍 → Opus 60倍 │
└─────────────────────────────────────────────────────────────┘
\\\
专为仅使用Haiku、Sonnet和Opus的Claude环境构建。
受节省成本技能启发,扩展为三层递进结构。