三层 Claude 路由:Haiku → Sonnet → Opus
从最便宜的模型开始。仅在需要时升级。节省 50-90% 的 API 成本。
黄金法则
如果一个人需要超过 30 秒的专注思考,就从 Haiku 升级到 Sonnet。
如果任务涉及架构、复杂权衡或深度推理,升级到 Opus。
成本对比
| 模型 | 输入 | 输出 | 相对成本 |
|---|
| Haiku | \$0.25/M | \$1.25/M | 1x(基准) |
| Sonnet | \$3.00/M | \$15.00/M | 12x |
| Opus | \$15.00/M | \$75.00/M | 60x |
结论: 选错模型要么浪费钱,要么浪费时间。简单任务用 Haiku,标准任务用 Sonnet,复杂任务用 Opus。
💚 HAIKU — 简单任务的默认选择
以下场景使用 Haiku:
- 事实问答 — "什么是X"、"谁是Y"、"Z什么时候发生的"
- 快速查询 — 定义、单位换算、短翻译
- 状态检查 — 日历、文件读取、会话监控
- 心跳检测 — 定期检查、HEARTBEAT_OK 响应
- 记忆与提醒 — "记住这个"、"提醒我..."
- 日常对话 — 问候、闲聊、确认
- 简单文件操作 — 读取、列表、基本写入
- 一句话任务 — 1-2 句话就能回答的任何问题
永远不要在 Haiku 上做这些
- ❌ 编写超过 10 行的代码
- ❌ 创建对比表格
- ❌ 写超过 3 段的内容
- ❌ 做多步分析
- ❌ 写报告或提案
💛 SONNET — 标准工作(主力模型)
以下场景升级到 Sonnet:
代码与技术
- 代码生成 — 编写函数、构建功能、脚本
- 代码审查 — PR 审查、质量检查
- 调试 — 标准问题排查
- 文档 — README、注释、用户指南
分析与规划
- 分析与评估 — 比较选项、评估权衡
- 规划 — 项目计划、路线图、任务分解
- 研究综合 — 整合多个来源
- 多步推理 — "首先...然后...最后"
写作与内容
- 长文写作 — 报告、提案、文章(>3 段)
- 创意写作 — 博客文章、描述、文案
- 摘要 — 长文档、转录稿
- 结构化输出 — 表格、大纲、格式化文档
❤️ OPUS — 仅用于复杂推理
以下场景升级到 Opus:
架构与设计
- 系统架构决策
- 大规模代码重构
- 需要权衡的设计模式选择
- 数据库 Schema 设计
深度分析
- 复杂调试(多文件、竞态条件)
- 安全审查
- 性能优化策略
- 隐蔽 Bug 的根因分析
战略与创意
- 战略规划 — 商业决策、路线图
- 细致判断 — 伦理、歧义、价值观冲突
- 深度研究 — 综合性多源分析
🔄 实现方式
子代理
\
\\
javascript
// 常规监控
sessions_spawn(task="检查备份状态", model="haiku")// 标准代码工作
sessions_spawn(task="构建 REST API 端点", model="sonnet")
// 架构决策
sessions_spawn(task="设计多租户数据库 Schema", 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 1x → Sonnet 12x → Opus 60x │
└─────────────────────────────────────────────────────────────┘
\\\
专为使用 Haiku、Sonnet 和 Opus 的 Claude 环境设计。
灵感来自 save-money 技能,扩展为三层渐进升级。
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")
\
\
\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.