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