🦞OpenClaw Guide
← Back to BlogOptimization

OpenClaw Model Routing: When to Use Haiku vs Sonnet vs Opus (Save 92% on Routine Tasks)

2026-03-178 min read

OpenClaw Model Routing: When to Use Haiku vs Sonnet vs Opus (Save 92% on Routine Tasks)

Target keywords: openclaw model routing, openclaw haiku sonnet


Most people default to Sonnet for everything. That's leaving serious money on the table.

Haiku costs 12x less than Sonnet. Not 20% less — 12x less. And for roughly 80% of the tasks an agent handles day-to-day — checking file status, summarizing notes, running commands, monitoring, formatting output, answering simple questions — Haiku performs just as well.

If you're running OpenClaw at any meaningful scale and your default model is Sonnet, you're paying for a sports car to do grocery runs. The work gets done, but the cost-to-value ratio is terrible.

Model routing fixes this by establishing a simple rule: Haiku by default, Sonnet only when the task actually demands it. Two config changes and one system prompt addition. That's the whole implementation.

Here's what the numbers look like.


Pricing Comparison: Haiku vs Sonnet vs Opus

ModelInput (per 1K tokens)Output (per 1K tokens)Best for
Claude Haiku$0.00025~$0.00125Routine tasks, monitoring, formatting, simple Q&A
Claude Sonnet$0.003~$0.015Complex reasoning, code review, architecture decisions
Claude Opus$0.015~$0.075Most demanding reasoning, highest-stakes analysis

The Haiku vs Sonnet gap: $0.00025 vs $0.003 per 1K input tokens. That's a 12x difference.

For output tokens it's similar. Run 1,000 routine tasks through Sonnet and you'll pay ~$3 on inputs alone. Run the same tasks through Haiku: $0.25.

The math compounds fast. A busy agent making 500 routine calls per day on Sonnet spends ~$1.50/day on inputs before doing anything complex. The same 500 calls on Haiku: $0.125/day. That's ~$40/month saved on inputs, from one config change.


Step 1: Update Your Config

Your config file lives at:

~/.openclaw/openclaw.json

Add or update it with these model settings:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-haiku-4-5"
      },
      "models": {
        "anthropic/claude-sonnet-4-5": {
          "alias": "sonnet"
        },
        "anthropic/claude-haiku-4-5": {
          "alias": "haiku"
        }
      }
    }
  }
}

What this does:

  • "primary": "anthropic/claude-haiku-4-5" — Sets Haiku as your global default. Every task that doesn't specify a model will use Haiku.
  • Model aliases — Creates shorthand names so your system prompt (and you, manually) can say "use sonnet" or "use haiku" to switch on demand without typing the full model string.

This is the foundation. The config change alone ensures you stop defaulting to Sonnet for everything. The routing rule below makes the switching intelligent.


Step 2: Add the Routing Rule to Your System Prompt

Paste this block into your SOUL.md or system prompt:

MODEL SELECTION RULE:
Default: Always use Haiku

Switch to Sonnet ONLY when:
- Architecture decisions
- Production code review
- Security analysis
- Complex debugging/reasoning
- Strategic multi-project decisions

When in doubt: Try Haiku first.

That last line is important. "When in doubt: Try Haiku first" prevents overthinking. Your agent doesn't need to deeply analyze each task before picking a model — it defaults to Haiku and escalates only when it hits one of the five triggers.

The triggers are deliberately narrow. "Architecture decisions," "production code review," "security analysis," "complex debugging/reasoning," "strategic multi-project decisions" — these are genuinely demanding tasks where Sonnet's stronger reasoning provides real value. Everything else is Haiku territory.


Decision Tree: Which Model for What

Use this to calibrate your expectations and supplement the routing rule:

Use Haiku for:

  • File operations (read, write, search, organize)
  • Status checks and monitoring
  • Simple summaries and reformatting
  • Running shell commands and interpreting output
  • Drafting routine messages (short emails, confirmations, quick responses)
  • Data extraction from structured content
  • Simple Q&A from known context
  • Heartbeat checks (or better: Ollama — see article 3)

Use Sonnet for:

  • Reviewing production code for bugs or security issues
  • Making architectural decisions with trade-offs
  • Debugging complex multi-system issues
  • Strategic planning with multiple competing priorities
  • Writing complex code from scratch (not editing/formatting existing code)
  • Tasks where a wrong answer has significant real-world consequences

Use Opus for:

  • The most demanding reasoning tasks where Sonnet is struggling
  • High-stakes analysis where maximum accuracy justifies maximum cost
  • In practice: most people never need Opus. Sonnet handles 95% of complex tasks well.

The key insight: the 5 Sonnet triggers in the routing rule are all tasks where reasoning quality is the bottleneck. If reasoning quality isn't the bottleneck — if the task is primarily about instruction-following, formatting, retrieval, or simple generation — Haiku wins on both cost and speed.


Real Cost Example: 100 Tasks/Week

Let's make the savings concrete. Assume:

  • 100 tasks/week
  • Each task averages 2KB input + 500 tokens output
  • Running on Sonnet vs Haiku for the routine 80% (80 tasks)
  • The other 20 tasks genuinely need Sonnet

Without model routing (Sonnet for everything):

InputsOutputsSubtotal
100 tasks × 2KB (2K tokens)200K tokens × $0.003$0.60
100 tasks × 500 output tokens50K tokens × $0.015$0.75
Weekly total$1.35
Monthly total~$5.85

With model routing (Haiku for 80 routine tasks, Sonnet for 20 complex):

ModelCost
80 routine tasks × 2K input tokensHaiku × $0.00025$0.04
80 routine tasks × 500 output tokensHaiku × $0.00125$0.05
20 complex tasks × 2K input tokensSonnet × $0.003$0.12
20 complex tasks × 500 output tokensSonnet × $0.015$0.15
Weekly total$0.36
Monthly total~$1.56

Monthly savings: ~$4.30 at 100 tasks/week. That's 73% reduction from routing alone.

Scale to 500 tasks/week (reasonable for an active agent) and you're saving $20+/month from this single change. At 2,000 tasks/week (automation-heavy use cases), you're looking at $80+/month.

The savings compound further when combined with session initialization (article 1) and prompt caching — the source guide shows the combined effect taking per-session costs from $0.47 down to $0.012.


When NOT to Use Haiku: The 5 Sonnet Triggers

The routing rule lists exactly when to escalate. Let's be specific about why each one qualifies:

1. Architecture decisions Haiku can describe options. What it's less reliable at: correctly weighting trade-offs, identifying subtle failure modes in a proposed design, or reasoning through second-order effects. Architecture decisions live or die on this kind of nuanced analysis. Worth the Sonnet cost.

2. Production code review Haiku will find obvious bugs. It will miss subtle concurrency issues, security edge cases, and logic errors that require holding multiple interacting components in mind simultaneously. Production code review is exactly where Sonnet's stronger context window utilization pays off.

3. Security analysis Security is adversarial reasoning — you're trying to think like an attacker and identify non-obvious exploit paths. This requires the kind of creative, multi-step reasoning that Haiku handles less reliably. Don't cut corners here.

4. Complex debugging/reasoning If you're already 20 minutes into a debugging session with no resolution, Haiku probably isn't going to crack it. Complex multi-system issues — especially ones involving race conditions, distributed state, or subtle environment differences — benefit from Sonnet's stronger reasoning.

5. Strategic multi-project decisions When decisions have dependencies across multiple projects, teams, or timeframes, the reasoning complexity justifies the cost. Haiku might miss cross-project implications that Sonnet catches.

Everything else: start with Haiku. You can always escalate if the response quality isn't sufficient. In practice, you'll rarely need to.


Implementation Checklist

  • Open ~/.openclaw/openclaw.json
  • Set "primary": "anthropic/claude-haiku-4-5" as default model
  • Add model aliases for sonnet and haiku
  • Add MODEL SELECTION RULE to SOUL.md or system prompt
  • Verify: Start a session, run session_status — default model should show Haiku

After setup, watch for the next few sessions. You should see Sonnet only appearing for the genuinely complex tasks. If Sonnet is still triggering for routine monitoring or file operations, review whether the routing rule is being loaded in your system prompt.


Before vs After

❌ Before✓ After
Default modelClaude SonnetClaude Haiku
Input cost$0.003/1K tokens$0.00025/1K tokens
Routine task costSonnet pricingHaiku pricing (12x cheaper)
Complex task costSonnet (correct)Sonnet (still correct)
Monthly model costs (moderate use)$50–70/month$5–10/month
Switching frictionManual every timeAutomatic via routing rule

Key Takeaways

  • Haiku is 12x cheaper than Sonnet — $0.00025 vs $0.003 per 1K input tokens. This is not a minor difference.
  • 80% of tasks don't need Sonnet — monitoring, file ops, formatting, simple generation, status checks. All Haiku territory.
  • Two changes, immediate results: openclaw.json default + routing rule in system prompt. That's the full implementation.
  • The 5 Sonnet triggers are narrow by design: Architecture, prod code review, security, complex debugging, strategic decisions. Everything else defaults to Haiku.
  • "When in doubt: Try Haiku first" — This is the practical rule. Escalate if quality isn't sufficient, not preemptively.
  • Combined with session init: Model routing + lean context together cut per-session costs from $0.40 to roughly $0.02.

Model routing is the second optimization in a five-part system. Combined with session initialization (article 1), heartbeat offloading to Ollama (article 3), rate limits, and prompt caching, the total reduction from $1,500+/month to under $50/month becomes achievable without any complex infrastructure changes.

Learn alongside 1,000+ operators

Ask questions, share workflows, and get help from people running OpenClaw every day.