Field Notes/Cost Optimization
🔍 Discovery

Model Routing: Right Model for the Job

3 min read

If you're running OpenClaw, you're probably overpaying. By a lot.

By default, everything goes to your primary model. Heartbeats? Opus. Calendar lookups? Opus. Sub-agents? All Opus. That's like hiring a lawyer to check your mailbox.

The Hidden Cost Multiplier

Heartbeats fire 48 times per day. Sub-agents spawn for parallel work. Simple queries hit the same $30/M-token model you use for complex coding.

Result: premium prices for simple tasks, and no resilience when rate limits hit.

The Fix: Model Tiering

  • Complex reasoning — architecture, refactoring → frontier model (Opus, GPT-5.2). Worth it.
  • Daily work — code gen, research → mid-tier (Sonnet, DeepSeek R1). 90% cheaper.
  • Simple tasks — heartbeats, lookups → cheapest that works. Gemini Flash-Lite is 60x cheaper than Opus.

One Config Change

Before (everything goes to Opus):

{
  "agents": {
    "defaults": {
      "model": "anthropic/claude-opus-4-5"
    }
  }
}

After (smart routing):

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-5",
        "fallbacks": [
          "openai/gpt-5.2",
          "deepseek/deepseek-reasoner"
        ]
      },
      "heartbeat": {
        "every": "30m",
        "model": "google/gemini-2.5-flash-lite"
      },
      "subagents": {
        "model": "deepseek/deepseek-reasoner"
      }
    }
  }
}

Heartbeats → Gemini Flash-Lite at $0.50/M instead of $30/M. Sub-agents → DeepSeek R1 at $2.74/M — 10x cheaper with solid reasoning.

Main tasks still hit Opus. Cheap models handle everything that doesn't need maximum intelligence.

What You'll Save

  • Light user — $200 → $70/month (65% savings)
  • Power user — $943 → $347/month (~$600 saved)
  • Heavy user — $2,750 → $1,000/month ($1,700+ saved)

The fallback chain adds resilience too — if Anthropic is rate-limited, GPT-5.2 picks up instead of your agent just stopping.

Bottom Line

Edit ~/.openclaw/openclaw.json, save, restart. You could be saving hundreds per month by the time you finish your coffee.