Agent skill · software engineering · jeremylongshore

openrouter-fallback-config

Configure automatic model fallbacks for high availability on OpenRouter.

Why this skill is useful

Adds specific patterns and configurations for implementing model fallbacks with OpenRouter that the AI wouldn't reliably generate on its own.

What it needs

Requires curl, jq, python3 installed locally. Requires openrouter account access. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

OpenRouter Fallback Config Overview OpenRouter supports native model fallbacks: pass multiple model IDs and OpenRouter tries each in order until one succeeds. You can also use provider.order to control which provider serves a specific model. This skill covers native fallbacks, provider routing, client-side fallback chains, and timeout configuration. Prerequisites An OpenRouter API key (sk-or-v1-...) exported as OPENROUTERAPIKEY — see the openrouter-install-auth skill for setup Python 3.8+ with the OpenAI SDK (pip install openai) for the fallback patterns; curl and jq for the Testing Fallbacks step A ranked list of acceptable models for your workload, matched by capability (tool calling, vision, context length) so a fallback never silently drops a feature you depend on Instructions 1. Start with Native Model Fallback (Server-Side): pass a models array plus route: "fallback" in extrabody and let OpenRouter try each model in order. 2. Log response.model after every call — it tells you which model actually served the request, which is how you detect that a fallback fired. 3. If you need the same model from specific vendors (e.g., Claude via Anthropic direct vs AWS Bedrock), use Provider Fallback with provider.order and allowfallbacks. 4. For per-model timeouts and custom error handling, implement the Client-Side Fallback Chain: resilientcompletion() walks FALLBACKCHAIN (primary → secondary → budget-fallback → last-resort) and raises once every entry fails. 5. Pick chains per feature with Fallback with Capability Matching — CAPABILITYCHAINS keeps tool-calling, vision, long-context, and budget workloads on models that actually support them. 6. Verify the behavior with Testing Fallbacks: send the curl request with an invalid primary model and confirm the response comes back from openai/gpt-4o-mini. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/openrouter-fallback-config--97368d

View the source on GitHub

Browse the @skills marketplace