Install
openclaw skills install openrouter-connect-missnamedUse this skill whenever the user wants to work with OpenRouter's free LLM models. Triggers include: any mention of "OpenRouter", "free models", "openrouter-connect", routing queries through a free LLM, writing code to call OpenRouter, or picking/testing an OpenRouter model. Also use when the user wants to proxy a question to a free model, compare free model outputs, or scaffold code (Python or JS/TS) that calls OpenRouter. Always use this skill when OpenRouter or free-tier LLM routing is involved.
openclaw skills install openrouter-connect-missnamedOpenClaw helps you:
Look for OPENROUTER_API_KEY in this priority order:
.env — ./ relative to the user's current working directory~/.env — the user's home directoryUse the helper script to resolve this:
python3 /home/claude/openrouter-connect/scripts/resolve_key.py
If no key is found, tell the user and show them the quick-start box:
No key found. Get a free key at https://openrouter.ai/keys then add it to
.env:OPENROUTER_API_KEY=sk-or-...
Run the discovery script to fetch and cache the free model list:
python3 /home/claude/openrouter-connect/scripts/discover_models.py [--refresh]
This calls GET https://openrouter.ai/api/v1/models (no auth required) and filters
for models where both pricing.prompt == "0" and pricing.completion == "0".
The script outputs a JSON array ranked by the default preference list (see
references/model_preferences.md for how ranking works and how to customise it).
Pass --refresh to bypass the 1-hour local cache.
Read references/model_preferences.md for the full preference system.
Quick summary:
To ask the user for their preference list, show them the discovered models and say:
"Here are the free models I found. Would you like to rank your favourites, or should I pick the best one automatically?"
Once a model is selected, call it directly using the script:
python3 /home/claude/openrouter-connect/scripts/proxy_query.py \
--model "mistralai/mistral-7b-instruct:free" \
--prompt "Your question here"
Stream the response back to the user and note which model was used.
If the model returns a 429 (rate limit) or 5xx, automatically retry with the next model in the ranked list. Log which model was tried and why it was skipped.
Read the appropriate template from references/:
references/python_template.mdreferences/typescript_template.mdFill in:
.env loading boilerplate (checks ./ then ~/)main() example with the user's actual prompt if they provided oneAlways include inline comments explaining the fallback logic.
| Situation | Behaviour |
|---|---|
| Model mid-list becomes paid | Skip it, log a warning, continue down the list |
| All ranked models unavailable | Fall back to auto-ranked free pool |
| No free models found at all | Tell the user — OpenRouter's free tier may be down |
| Key found but invalid (401) | Prompt user to check the key; show the OpenRouter keys URL |
| User provides a model not in the free list | Warn them it may incur cost; ask to confirm |
| Streaming not supported by model | Fall back to non-streaming request silently |
| File | When to read |
|---|---|
references/model_preferences.md | Ranking algorithm, customisation, default weights |
references/python_template.md | Generating Python code |
references/typescript_template.md | Generating TS/JS code |