openrouter-fallback

Configures OpenRouter as a cloud model fallback when local LLM tiers are unavailable.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/diazMelgarejo/orama-system --skill openrouter-fallback-diazmelgarejo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openrouter-fallback
Source: https://github.com/diazMelgarejo/orama-system/tree/main/bin/orama-system/skills/openrouter-fallback
Command: npx skills add https://github.com/diazMelgarejo/orama-system --skill openrouter-fallback-diazmelgarejo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When local and regional LLM providers (ClinePass, LM Studio, Ollama, GLM-5.2) all go down, agent workflows stall completely. This Skill provides a final cloud fallback tier via OpenRouter so queued tasks can still be routed to hosted models like GPT-4o. ## Core Features & Use Cases - Secure API Key Management: Stores the OpenRouter API key in ~/.openclaw/secrets/openrouter-api-key with mode 600 permissions, never tracked in git. - Idempotent Setup Script: setup-openrouter.sh prompts for the key, writes the environment file, migrates legacy config, optionally wires shell profiles, and tests connectivity. - Fallback Chain Integration: Documents curl and Node.js patterns for routing requests to OpenRouter when tiers 1-4 fail, plus a --status health check. - Use Case: An agent's local Ollama and LM Studio instances are offline; the skill's exported environment variables let the agent call OpenRouter's GPT-4o endpoint with zero code changes. ## Quick Start Run the setup script with bash bin/orama-system/skills/openrouter-fallback/setup-openrouter.sh and enter your OpenRouter API key when prompted.

Frequently Asked Questions about openrouter-fallback

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up OpenRouter as a fallback for local LLMs?

Run bash setup-openrouter.sh and enter your OpenRouter API key when prompted. The script stores the key securely, creates the environment file, tests connectivity, and optionally wires your shell profile to export the variables.

How do I call the OpenRouter API with curl?

Send a POST request to https://openrouter.ai/api/v1/chat/completions with an Authorization Bearer header containing your API key and a JSON body specifying the model and messages array. The skill exports OPENROUTER_ENDPOINT and OPENROUTER_API_KEY for this.

Where is the OpenRouter API key stored securely?

The key is stored in ~/.openclaw/secrets/openrouter-api-key with mode 600 permissions, readable only by the owner. It is never committed to git and is sourced at runtime from ~/.openclaw/.env.openrouter.

Why does OpenRouter return a 401 Unauthorized error?

A 401 error means the API key is invalid or expired. Re-run setup-openrouter.sh and choose to replace the existing key with a valid one from your OpenRouter dashboard.

When should I use OpenRouter instead of local models?

Use OpenRouter only when all local tiers (ClinePass, LM Studio, Ollama, GLM-5.2) are down. It is the fifth and final fallback because it is slower and billed per token by OpenRouter.