OpenRouter Free Model Failover
Purpose
Ensure OpenClaw always uses free OpenRouter models with intelligent priority-based failover. No paid model should ever be invoked. The cascade is ranked by coding/agentic capability and falls over automatically on rate limits, downtime, moderation blocks, or context overflow.
Architecture (Two-Layer Failover)
Layer 1: OpenClaw-side fallback chain (primary)
OpenClaw's native failover via agents.defaults.model.primary + agents.defaults.model.fallbacks:
- Tries primary model first
- On ANY error (rate limit, auth, billing, timeout, overloaded), rotates to next fallback
- Exponential cooldown: 1min → 5min → 25min → 1hr cap
- Session-sticky: pins to working model until session reset or cooldown clears
FallbackSummaryError when all candidates exhausted (includes soonest cooldown expiry)
Layer 2: OpenRouter-side server failover (complementary)
OpenRouter's models array parameter handles per-request failover transparently:
- If a model returns error (429, 503, moderation, context overflow), tries next in array
- Pricing based on model actually used (all free = $0)
- Works automatically with OpenAI-compatible API
Combined: OpenClaw chains across models; within each model attempt, OpenRouter can cascade if the models param is forwarded.
Rate Limits (Critical Constraints)
| Constraint |
Limit |
:free model requests per minute |
20 req/min |
| Daily limit (< 10 credits purchased) |
50 req/day |
| Daily limit (≥ 10 credits purchased) |
1,000 req/day |
| Negative credit balance |
402 errors even for free models |
Implications:
- Free tier (50/day) is extremely limited for agentic coding — consider purchasing 10 credits ($10 one-time) for 20x daily capacity
- 20 req/min shared across ALL free model calls on the key
- Multiple API keys do NOT bypass limits (governed globally per account)
- Different models have different per-model rate limits (spreading across models helps)
Prioritized Free Model Cascade (Coding/Agentic)
Ranked by: coding benchmark scores, parameter count, context window, tool/function calling support.
Tier 1: Heavy Hitters (primary + first fallbacks)
| Priority |
OpenClaw Model Ref |
Params |
Context |
Strength |
| 1 |
openrouter/qwen/qwen3-coder:free |
480B MoE/35B active |
262K |
Agentic coding champion, largest context |
| 2 |
openrouter/nvidia/nemotron-3-super-120b-a12b:free |
120B MoE/12B active |
262K |
Programming #6 ranked, 262K context |
| 3 |
openrouter/minimax/minimax-m2.5:free |
— |
197K |
SWE-Bench 80.2%, strong coding |
| 4 |
openrouter/nousresearch/hermes-3-llama-3.1-405b:free |
405B |
131K |
Largest dense model, advanced agentic |
| 5 |
openrouter/openai/gpt-oss-120b:free |
117B MoE/5.1B active |
131K |
Tool use + reasoning |
Tier 2: Solid Performers (secondary fallbacks)
| Priority |
OpenClaw Model Ref |
Params |
Context |
Strength |
| 6 |
openrouter/meta-llama/llama-3.3-70b-instruct:free |
70B |
65K |
Battle-tested, reliable |
| 7 |
openrouter/z-ai/glm-4.5-air:free |
MoE |
131K |
Agent-focused, thinking modes |
| 8 |
openrouter/arcee-ai/trinity-large-preview:free |
400B MoE |
131K |
⚠️ May expire — check availability |
| 9 |
openrouter/openai/gpt-oss-20b:free |
21B MoE |
131K |
Tool support, lightweight |
| 10 |
openrouter/google/gemma-3-27b-it:free |
27B |
131K |
Multimodal capable |
Tier 3: Lightweight Fallbacks (emergency)
| Priority |
OpenClaw Model Ref |
Params |
Context |
| 11 |
openrouter/google/gemma-4-26b-a4b-it:free |
26B MoE |
131K |
| 12 |
openrouter/nvidia/nemotron-3-nano-30b-a3b:free |
30B MoE |
131K |
| 13 |
openrouter/google/gemma-3-12b-it:free |
12B |
131K |
| 14 |
openrouter/nvidia/nemotron-nano-9b-v2:free |
9B |
131K |
| 15 |
openrouter/google/gemma-3-4b-it:free |
4B |
131K |
| 16 |
openrouter/meta-llama/llama-3.2-3b-instruct:free |
3B |
131K |
Meta-Router (last resort)
| Priority |
Model |
Notes |
| 17 |
openrouter/openrouter/free |
Random selection from available free models — no priority control |
OpenClaw Configuration
Config location
~/.openclaw/openclaw.json (Windows: %USERPROFILE%\.openclaw\openclaw.json)
Required config changes (JSON5)
{
// Environment
env: {
OPENROUTER_API_KEY: "sk-or-v1-...",
},
// Model cascade — free only
agents: {
defaults: {
model: {
primary: "openrouter/qwen/qwen3-coder:free",
fallbacks: [
"openrouter/nvidia/nemotron-3-super-120b-a12b:free",
"openrouter/minimax/minimax-m2.5:free",
"openrouter/nousresearch/hermes-3-llama-3.1-405b:free",
"openrouter/openai/gpt-oss-120b:free",
"openrouter/meta-llama/llama-3.3-70b-instruct:free",
"openrouter/z-ai/glm-4.5-air:free",
"openrouter/arcee-ai/trinity-large-preview:free",
"openrouter/openai/gpt-oss-20b:free",
"openrouter/google/gemma-3-27b-it:free",
"openrouter/google/gemma-4-26b-a4b-it:free",
"openrouter/nvidia/nemotron-3-nano-30b-a3b:free",
"openrouter/google/gemma-3-12b-it:free",
],
},
// Allowlist — all free models
models: {
"openrouter/qwen/qwen3-coder:free": { alias: "qwen-coder" },
"openrouter/nvidia/nemotron-3-super-120b-a12b:free": { alias: "nemotron-super" },
"openrouter/minimax/minimax-m2.5:free": { alias: "minimax" },
"openrouter/nousresearch/hermes-3-llama-3.1-405b:free": { alias: "hermes" },
"openrouter/openai/gpt-oss-120b:free": { alias: "gpt-oss" },
"openrouter/meta-llama/llama-3.3-70b-instruct:free": { alias: "llama" },
"openrouter/z-ai/glm-4.5-air:free": { alias: "glm" },
"openrouter/arcee-ai/trinity-large-preview:free": { alias: "trinity" },
"openrouter/openai/gpt-oss-20b:free": { alias: "gpt-oss-sm" },
"openrouter/google/gemma-3-27b-it:free": { alias: "gemma-27b" },
"openrouter/google/gemma-4-26b-a4b-it:free": { alias: "gemma-4" },
"openrouter/nvidia/nemotron-3-nano-30b-a3b:free": { alias: "nemotron-nano" },
"openrouter/google/gemma-3-12b-it:free": { alias: "gemma-12b" },
},
// Image model (multimodal free)
imageModel: {
primary: "openrouter/google/gemma-3-27b-it:free",
fallbacks: [
"openrouter/google/gemma-4-26b-a4b-it:free",
"openrouter/google/gemma-3-12b-it:free",
],
},
},
},
// OpenRouter provider definition
models: {
providers: {
openrouter: {
baseUrl: "https://openrouter.ai/api/v1",
apiKey: "${OPENROUTER_API_KEY}",
api: "openai-completions",
models: [
// Populate via `openclaw models scan` or manually
],
},
},
},
}
Key config rules
- Every model ref must use
openrouter/ prefix in OpenClaw (e.g., openrouter/qwen/qwen3-coder:free)
:free suffix is part of the model ID — OpenRouter uses this to route to free endpoints
agents.defaults.models acts as an allowlist — if set, only listed models can be selected
- Config hot-reloads — model/agent changes apply without gateway restart
- Remove ALL paid models from
models.providers.openrouter.models array
Dynamic Model Refresh (canonical — use this, not manual CLI)
scripts/refresh-openclaw-models.js replaces all manual model selection.
It:
- Fetches
/api/v1/models live from OpenRouter.
- Filters to
:free models only (zero prompt + completion cost).
- Scores each model per task profile using quantitative signals.
- Reads the current Windows OpenClaw config via SSH.
- Writes the new ranked chain (primary + fallbacks) back via SCP.
- Verifies the result with
openclaw models status.
Scoring formula
For each model:
score = log2(context_length) × ctxWeight
+ log2(max_completion_tokens) × outWeight
+ boostScore (if model id matches profile keyword set)
| Profile |
ctxWeight |
outWeight |
Boost keywords |
Boost amount |
| coding |
2.0 |
0.5 |
coder, qwen3, deepseek, nemotron, codestral |
+30 |
| general |
1.5 |
0.3 |
llama, hermes, glm, mistral, gemma |
+12 |
| image |
1.0 |
0.2 |
gemma, llava, pixtral, qwen-vl |
+20 |
Context length is weighted most heavily for coding because agentic coding tasks require reading full file trees, long diffs, and accumulated context.
Usage
# Session start or after any model changes — coding tasks (default)
npm run models:refresh
# For general-purpose work
npm run models:refresh:general
# For multimodal / image-input tasks
npm run models:refresh:image
# Custom: top-N, explicit profile
node scripts/refresh-openclaw-models.js coding 10
Run at session start and after any reported model degradation or failover exhaustion.
CLI Operations (fallback — when script cannot run)
Troubleshoot failures
# Check model status and auth
openclaw models status --probe
# Check cooldown state
cat ~/.openclaw/agents/default/agent/auth-state.json
# Check gateway health
openclaw health
openclaw doctor
# View recent logs
openclaw logs --tail 50
# Force clear cooldowns (nuclear option)
rm ~/.openclaw/agents/default/agent/auth-state.json
openclaw gateway restart
Failover Behavior Reference
What triggers failover
| Error Type |
OpenClaw Action |
Cooldown |
| 429 Rate limit |
Auth profile rotation → model fallback |
1min → 5min → 25min → 1hr |
| 503 Service unavailable |
Immediate model fallback |
1min backoff |
| Billing/credit errors |
Profile disabled, long backoff |
5hr → 10hr → 24hr cap |
| Timeout |
Classified as failover-worthy |
1min backoff |
| Moderation block |
Model fallback |
No cooldown |
| Context overflow |
Stays in compaction/retry (no fallback) |
N/A |
| Auth failure |
Profile rotation → model fallback |
Immediate skip |
Cooldown recovery
- Cooldowns use exponential backoff: 1min → 5min → 25min → 1hr cap
- Billing disables: 5hr → doubling → 24hr cap
- Counters reset after 24hr of no failures
- Primary model can be probed near cooldown expiry (auto-recovery)
Edge Cases & Gotchas
Expiring models: Some free models (e.g., trinity-large-preview) are temporary promotions. Check OpenRouter's model page for expiry dates. Remove expired models from fallbacks.
Negative credit balance: Even free models return 402 if account balance is negative. Keep balance ≥ $0.
Tool calling support: Not all free models support function/tool calling. The openclaw models scan probes for this. Prefer models with confirmed tool support for agentic work.
Context window mismatch: Free models range from 65K to 262K tokens. OpenClaw does NOT failover on context overflow — it retries with compaction. Set maxTokens appropriately per model.
Model ID normalization: OpenRouter uses provider/model:free format. OpenClaw prepends openrouter/ prefix. The full ref is openrouter/provider/model:free.
Z.AI normalization: OpenClaw normalizes z.ai/* to zai/* internally. Use openrouter/z-ai/glm-4.5-air:free as the ref.
Daily limit exhaustion: At 50 req/day (free tier), an agentic coding session can exhaust limits in ~30 minutes. Buying 10 credits ($10) increases to 1,000/day.
Config validation: OpenClaw strictly validates openclaw.json. Unknown keys prevent gateway startup. Always run openclaw doctor after manual edits.
Maintenance Schedule
| Task |
Frequency |
Command |
| Refresh free model list |
Session start + monthly |
npm run models:refresh |
| Refresh after degradation |
After failover exhaustion |
npm run models:refresh |
| General/image profile refresh |
Task-type change |
npm run models:refresh:general or :image |
| Verify no paid models |
After any config change |
openclaw models status on inference host |
| Check rate limit status |
When failures increase |
curl https://openrouter.ai/api/v1/auth/key -H "Authorization: Bearer $KEY" |
| Clear stale cooldowns |
After extended downtime |
Delete auth-state.json + restart |
Quick Decision Matrix
| Scenario |
Action |
| Need to configure from scratch |
Use CLI commands in "Initial setup" section |
| Model returning errors |
Check openclaw models status --probe → verify :free suffix |
| All models failing |
Check daily limit (/api/v1/key), credit balance, auth-state cooldowns |
| New free model launched |
openclaw models scan → add to fallbacks if ranked high |
| Model expired/removed |
openclaw models fallbacks remove <ref> → remove from allowlist |
| Need more daily requests |
Purchase 10 credits on OpenRouter ($10 one-time) |
| Agent not using expected model |
Check /model status in chat, verify allowlist includes model |
1---
2name: openrouter-free-failover
3description: Configure and maintain optimal OpenRouter free model failover for OpenClaw. Prioritized cascade of free models ranked by coding capability, with automatic failover on rate limits, downtime, and errors. Load this skill when configuring models, troubleshooting model availability, or refreshing the free model inventory.
4argument-hint: "[goal: configure|refresh|status|troubleshoot] [context: coding|general|lightweight]"
5user-invocable: true
6disable-model-invocation: false
7---
8
9# OpenRouter Free Model Failover
10
11## Purpose
12
13Ensure OpenClaw always uses **free** OpenRouter models with intelligent priority-based failover. No paid model should ever be invoked. The cascade is ranked by coding/agentic capability and falls over automatically on rate limits, downtime, moderation blocks, or context overflow.
14
15---
16
17## Architecture (Two-Layer Failover)
18
19### Layer 1: OpenClaw-side fallback chain (primary)
20
21OpenClaw's native failover via `agents.defaults.model.primary` + `agents.defaults.model.fallbacks`:
22
23- Tries primary model first
24- On ANY error (rate limit, auth, billing, timeout, overloaded), rotates to next fallback
25- Exponential cooldown: 1min → 5min → 25min → 1hr cap
26- Session-sticky: pins to working model until session reset or cooldown clears
27- `FallbackSummaryError` when all candidates exhausted (includes soonest cooldown expiry)
28
29### Layer 2: OpenRouter-side server failover (complementary)
30
31OpenRouter's `models` array parameter handles per-request failover transparently:
32
33- If a model returns error (429, 503, moderation, context overflow), tries next in array
34- Pricing based on model actually used (all free = $0)
35- Works automatically with OpenAI-compatible API
36
37### Combined: OpenClaw chains across models; within each model attempt, OpenRouter can cascade if the `models` param is forwarded.
38
39---
40
41## Rate Limits (Critical Constraints)
42
43| Constraint | Limit |
44|---|---|
45| `:free` model requests per minute | **20 req/min** |
46| Daily limit (< 10 credits purchased) | **50 req/day** |
47| Daily limit (≥ 10 credits purchased) | **1,000 req/day** |
48| Negative credit balance | **402 errors even for free models** |
49
50**Implications**:
51- Free tier (50/day) is extremely limited for agentic coding — consider purchasing 10 credits ($10 one-time) for 20x daily capacity
52- 20 req/min shared across ALL free model calls on the key
53- Multiple API keys do NOT bypass limits (governed globally per account)
54- Different models have different per-model rate limits (spreading across models helps)
55
56---
57
58## Prioritized Free Model Cascade (Coding/Agentic)
59
60Ranked by: coding benchmark scores, parameter count, context window, tool/function calling support.
61
62### Tier 1: Heavy Hitters (primary + first fallbacks)
63
64| Priority | OpenClaw Model Ref | Params | Context | Strength |
65|---|---|---|---|---|
66| 1 | `openrouter/qwen/qwen3-coder:free` | 480B MoE/35B active | 262K | Agentic coding champion, largest context |
67| 2 | `openrouter/nvidia/nemotron-3-super-120b-a12b:free` | 120B MoE/12B active | 262K | Programming #6 ranked, 262K context |
68| 3 | `openrouter/minimax/minimax-m2.5:free` | — | 197K | SWE-Bench 80.2%, strong coding |
69| 4 | `openrouter/nousresearch/hermes-3-llama-3.1-405b:free` | 405B | 131K | Largest dense model, advanced agentic |
70| 5 | `openrouter/openai/gpt-oss-120b:free` | 117B MoE/5.1B active | 131K | Tool use + reasoning |
71
72### Tier 2: Solid Performers (secondary fallbacks)
73
74| Priority | OpenClaw Model Ref | Params | Context | Strength |
75|---|---|---|---|---|
76| 6 | `openrouter/meta-llama/llama-3.3-70b-instruct:free` | 70B | 65K | Battle-tested, reliable |
77| 7 | `openrouter/z-ai/glm-4.5-air:free` | MoE | 131K | Agent-focused, thinking modes |
78| 8 | `openrouter/arcee-ai/trinity-large-preview:free` | 400B MoE | 131K | ⚠️ May expire — check availability |
79| 9 | `openrouter/openai/gpt-oss-20b:free` | 21B MoE | 131K | Tool support, lightweight |
80| 10 | `openrouter/google/gemma-3-27b-it:free` | 27B | 131K | Multimodal capable |
81
82### Tier 3: Lightweight Fallbacks (emergency)
83
84| Priority | OpenClaw Model Ref | Params | Context |
85|---|---|---|---|
86| 11 | `openrouter/google/gemma-4-26b-a4b-it:free` | 26B MoE | 131K |
87| 12 | `openrouter/nvidia/nemotron-3-nano-30b-a3b:free` | 30B MoE | 131K |
88| 13 | `openrouter/google/gemma-3-12b-it:free` | 12B | 131K |
89| 14 | `openrouter/nvidia/nemotron-nano-9b-v2:free` | 9B | 131K |
90| 15 | `openrouter/google/gemma-3-4b-it:free` | 4B | 131K |
91| 16 | `openrouter/meta-llama/llama-3.2-3b-instruct:free` | 3B | 131K |
92
93### Meta-Router (last resort)
94
95| Priority | Model | Notes |
96|---|---|---|
97| 17 | `openrouter/openrouter/free` | Random selection from available free models — no priority control |
98
99---
100
101## OpenClaw Configuration
102
103### Config location
104
105`~/.openclaw/openclaw.json` (Windows: `%USERPROFILE%\.openclaw\openclaw.json`)
106
107### Required config changes (JSON5)
108
109```json5
110{
111 // Environment
112 env: {
113 OPENROUTER_API_KEY: "sk-or-v1-...",
114 },
115
116 // Model cascade — free only
117 agents: {
118 defaults: {
119 model: {
120 primary: "openrouter/qwen/qwen3-coder:free",
121 fallbacks: [
122 "openrouter/nvidia/nemotron-3-super-120b-a12b:free",
123 "openrouter/minimax/minimax-m2.5:free",
124 "openrouter/nousresearch/hermes-3-llama-3.1-405b:free",
125 "openrouter/openai/gpt-oss-120b:free",
126 "openrouter/meta-llama/llama-3.3-70b-instruct:free",
127 "openrouter/z-ai/glm-4.5-air:free",
128 "openrouter/arcee-ai/trinity-large-preview:free",
129 "openrouter/openai/gpt-oss-20b:free",
130 "openrouter/google/gemma-3-27b-it:free",
131 "openrouter/google/gemma-4-26b-a4b-it:free",
132 "openrouter/nvidia/nemotron-3-nano-30b-a3b:free",
133 "openrouter/google/gemma-3-12b-it:free",
134 ],
135 },
136 // Allowlist — all free models
137 models: {
138 "openrouter/qwen/qwen3-coder:free": { alias: "qwen-coder" },
139 "openrouter/nvidia/nemotron-3-super-120b-a12b:free": { alias: "nemotron-super" },
140 "openrouter/minimax/minimax-m2.5:free": { alias: "minimax" },
141 "openrouter/nousresearch/hermes-3-llama-3.1-405b:free": { alias: "hermes" },
142 "openrouter/openai/gpt-oss-120b:free": { alias: "gpt-oss" },
143 "openrouter/meta-llama/llama-3.3-70b-instruct:free": { alias: "llama" },
144 "openrouter/z-ai/glm-4.5-air:free": { alias: "glm" },
145 "openrouter/arcee-ai/trinity-large-preview:free": { alias: "trinity" },
146 "openrouter/openai/gpt-oss-20b:free": { alias: "gpt-oss-sm" },
147 "openrouter/google/gemma-3-27b-it:free": { alias: "gemma-27b" },
148 "openrouter/google/gemma-4-26b-a4b-it:free": { alias: "gemma-4" },
149 "openrouter/nvidia/nemotron-3-nano-30b-a3b:free": { alias: "nemotron-nano" },
150 "openrouter/google/gemma-3-12b-it:free": { alias: "gemma-12b" },
151 },
152 // Image model (multimodal free)
153 imageModel: {
154 primary: "openrouter/google/gemma-3-27b-it:free",
155 fallbacks: [
156 "openrouter/google/gemma-4-26b-a4b-it:free",
157 "openrouter/google/gemma-3-12b-it:free",
158 ],
159 },
160 },
161 },
162
163 // OpenRouter provider definition
164 models: {
165 providers: {
166 openrouter: {
167 baseUrl: "https://openrouter.ai/api/v1",
168 apiKey: "${OPENROUTER_API_KEY}",
169 api: "openai-completions",
170 models: [
171 // Populate via `openclaw models scan` or manually
172 ],
173 },
174 },
175 },
176}
177```
178
179### Key config rules
180
1811. **Every model ref must use `openrouter/` prefix** in OpenClaw (e.g., `openrouter/qwen/qwen3-coder:free`)
1822. **`:free` suffix is part of the model ID** — OpenRouter uses this to route to free endpoints
1833. **`agents.defaults.models` acts as an allowlist** — if set, only listed models can be selected
1844. **Config hot-reloads** — model/agent changes apply without gateway restart
1855. **Remove ALL paid models** from `models.providers.openrouter.models` array
186
187---
188
189## Dynamic Model Refresh (canonical — use this, not manual CLI)
190
191`scripts/refresh-openclaw-models.js` replaces all manual model selection.
192
193It:
1941. Fetches `/api/v1/models` live from OpenRouter.
1952. Filters to `:free` models only (zero prompt + completion cost).
1963. Scores each model per task profile using quantitative signals.
1974. Reads the current Windows OpenClaw config via SSH.
1985. Writes the new ranked chain (primary + fallbacks) back via SCP.
1996. Verifies the result with `openclaw models status`.
200
201### Scoring formula
202
203For each model:
204```
205score = log2(context_length) × ctxWeight
206 + log2(max_completion_tokens) × outWeight
207 + boostScore (if model id matches profile keyword set)
208```
209
210| Profile | ctxWeight | outWeight | Boost keywords | Boost amount |
211|---------|-----------|-----------|----------------|--------------|
212| coding | 2.0 | 0.5 | coder, qwen3, deepseek, nemotron, codestral | +30 |
213| general | 1.5 | 0.3 | llama, hermes, glm, mistral, gemma | +12 |
214| image | 1.0 | 0.2 | gemma, llava, pixtral, qwen-vl | +20 |
215
216Context length is weighted most heavily for coding because agentic coding tasks require reading full file trees, long diffs, and accumulated context.
217
218### Usage
219
220```bash
221# Session start or after any model changes — coding tasks (default)
222npm run models:refresh
223
224# For general-purpose work
225npm run models:refresh:general
226
227# For multimodal / image-input tasks
228npm run models:refresh:image
229
230# Custom: top-N, explicit profile
231node scripts/refresh-openclaw-models.js coding 10
232```
233
234Run at session start and after any reported model degradation or failover exhaustion.
235
236## CLI Operations (fallback — when script cannot run)
237
238### Troubleshoot failures
239
240```bash
241# Check model status and auth
242openclaw models status --probe
243
244# Check cooldown state
245cat ~/.openclaw/agents/default/agent/auth-state.json
246
247# Check gateway health
248openclaw health
249openclaw doctor
250
251# View recent logs
252openclaw logs --tail 50
253
254# Force clear cooldowns (nuclear option)
255rm ~/.openclaw/agents/default/agent/auth-state.json
256openclaw gateway restart
257```
258
259---
260
261## Failover Behavior Reference
262
263### What triggers failover
264
265| Error Type | OpenClaw Action | Cooldown |
266|---|---|---|
267| 429 Rate limit | Auth profile rotation → model fallback | 1min → 5min → 25min → 1hr |
268| 503 Service unavailable | Immediate model fallback | 1min backoff |
269| Billing/credit errors | Profile disabled, long backoff | 5hr → 10hr → 24hr cap |
270| Timeout | Classified as failover-worthy | 1min backoff |
271| Moderation block | Model fallback | No cooldown |
272| Context overflow | Stays in compaction/retry (no fallback) | N/A |
273| Auth failure | Profile rotation → model fallback | Immediate skip |
274
275### Cooldown recovery
276
277- Cooldowns use exponential backoff: 1min → 5min → 25min → 1hr cap
278- Billing disables: 5hr → doubling → 24hr cap
279- Counters reset after 24hr of no failures
280- Primary model can be probed near cooldown expiry (auto-recovery)
281
282---
283
284## Edge Cases & Gotchas
285
2861. **Expiring models**: Some free models (e.g., `trinity-large-preview`) are temporary promotions. Check OpenRouter's model page for expiry dates. Remove expired models from fallbacks.
287
2882. **Negative credit balance**: Even free models return 402 if account balance is negative. Keep balance ≥ $0.
289
2903. **Tool calling support**: Not all free models support function/tool calling. The `openclaw models scan` probes for this. Prefer models with confirmed tool support for agentic work.
291
2924. **Context window mismatch**: Free models range from 65K to 262K tokens. OpenClaw does NOT failover on context overflow — it retries with compaction. Set `maxTokens` appropriately per model.
293
2945. **Model ID normalization**: OpenRouter uses `provider/model:free` format. OpenClaw prepends `openrouter/` prefix. The full ref is `openrouter/provider/model:free`.
295
2966. **Z.AI normalization**: OpenClaw normalizes `z.ai/*` to `zai/*` internally. Use `openrouter/z-ai/glm-4.5-air:free` as the ref.
297
2987. **Daily limit exhaustion**: At 50 req/day (free tier), an agentic coding session can exhaust limits in ~30 minutes. Buying 10 credits ($10) increases to 1,000/day.
299
3008. **Config validation**: OpenClaw strictly validates `openclaw.json`. Unknown keys prevent gateway startup. Always run `openclaw doctor` after manual edits.
301
302---
303
304## Maintenance Schedule
305
306| Task | Frequency | Command |
307|---|---|---|
308| Refresh free model list | Session start + monthly | `npm run models:refresh` |
309| Refresh after degradation | After failover exhaustion | `npm run models:refresh` |
310| General/image profile refresh | Task-type change | `npm run models:refresh:general` or `:image` |
311| Verify no paid models | After any config change | `openclaw models status` on inference host |
312| Check rate limit status | When failures increase | `curl https://openrouter.ai/api/v1/auth/key -H "Authorization: Bearer $KEY"` |
313| Clear stale cooldowns | After extended downtime | Delete `auth-state.json` + restart |
314
315---
316
317## Quick Decision Matrix
318
319| Scenario | Action |
320|---|---|
321| Need to configure from scratch | Use CLI commands in "Initial setup" section |
322| Model returning errors | Check `openclaw models status --probe` → verify `:free` suffix |
323| All models failing | Check daily limit (`/api/v1/key`), credit balance, auth-state cooldowns |
324| New free model launched | `openclaw models scan` → add to fallbacks if ranked high |
325| Model expired/removed | `openclaw models fallbacks remove <ref>` → remove from allowlist |
326| Need more daily requests | Purchase 10 credits on OpenRouter ($10 one-time) |
327| Agent not using expected model | Check `/model status` in chat, verify allowlist includes model |