OpenClaw Model Fallback Chain Guide: Rate Limits, Failover & Cost Optimization

· Updated

A well-designed fallback chain is OpenClaw’s core availability architecture. It keeps your agent seamlessly operational when Anthropic rate-limits you or OpenAI goes down — users never notice the switch.

The Core Principle

Fallback should optimize for availability first, then cost, then style consistency.

Practical Chain Design

Use cross-provider interleaving:

  1. Primary high-quality model (e.g., Claude Opus)
  2. Different provider, similar quality (e.g., GPT Codex)
  3. Cost-effective model (e.g., MiniMax M2.1)
  4. Fast-response model (e.g., Gemini Flash)
  5. Safety net (e.g., GLM)

This prevents provider-level incidents from taking down the whole chain.

Full Configuration Example

In ~/.openclaw/openclaw.json:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-6",
        "fallbacks": [
          "openai-codex/gpt-5.3-codex",
          "minimax-portal/MiniMax-M2.1",
          "google/gemini-3-pro-high",
          "google/gemini-3-flash",
          "zai/glm-4.7"
        ]
      }
    }
  }
}

Why this order? Opus → Codex switches providers to avoid rate-limit collision. MiniMax provides cost-effective fallback. Gemini ensures availability. GLM is the final safety net.

Operational Rules

Per-Task Model Overrides

OpenClaw supports model overrides per session or cron job:

Prompt Compatibility Tips

FAQ

Q: How do I tell if it’s a rate limit vs. a network issue? A: 429 returns a clear HTTP status code — logs show 429 Too Many Requests. Network issues show ETIMEOUT or ECONNREFUSED.

Q: Will falling back to weaker models hurt the experience? A: Brief fallbacks are usually invisible to users — most daily conversations work fine on Sonnet or Flash. Only complex reasoning and long tool-call chains show differences.

Q: How do I know which model is currently active? A: Run openclaw status to see the current session’s model, or check the logs for model selection events.

Bottom Line

A fallback chain is not cost optimization — it’s your uptime architecture. A well-configured chain is more reliable than any single top-tier model.

To apply this in production, pair this guide with:

Was this article helpful?

đź’¬ Comments