---
name: "openrouter-model-routing-failover"
description: "Access 100+ open and proprietary language models through a single OpenAI-compatible API."
metadata:
  author: "OpenRouter"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "call models with openrouter"
  - "use openrouter auto router"
  - "configure openrouter fallbacks"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# OpenRouter API Unified Multi-Provider Routing

Integrates OpenRouter unified API: dynamically routing between models (Anthropic, Meta Llama 3, Mistral, Google Gemini), auto-routing to the cheapest provider, and handling fallbacks.

## When to Invoke
Invoke this skill whenever you need to:
- call models with openrouter
- use openrouter auto router
- configure openrouter fallbacks

## Execution SOP & Rules
1. Configure OpenAI SDK with baseURL: 'https://openrouter.ai/api/v1' and OpenRouter API key.
2. Specify model parameter (e.g. 'anthropic/claude-3.5-sonnet' or 'meta-llama/llama-3.3-70b-instruct').
3. Include HTTP-Referer and X-Title headers for application ranking and analytics.
4. Inspect provider routing preferences (e.g. quantization, price, throughput) in request options.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
