/openrouter:model-routing-patternsfrom openrouter
Provides OpenRouter model routing templates and strategies for cost, speed, quality optimization and fallback chains in AI applications.
Ships in openrouter. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Production-ready model routing configurations and strategies for OpenRouter that optimize for cost, speed, quality, or balanced performance with intelligent fallback chains.
This skill provides comprehensive templates, scripts, and strategies for implementing sophisticated model routing in OpenRouter-powered applications. It helps you:
Use this skill when:
Goal: Minimize API costs while maintaining acceptable quality
Strategy:
Template: templates/cost-optimized-routing.json
Best for:
Goal: Minimize latency and response time
Strategy:
Template: templates/speed-optimized-routing.json
Best for:
Goal: Maximize output quality with premium models
Strategy:
Template: templates/quality-optimized-routing.json
Best for:
Goal: Dynamically route based on task complexity
Strategy:
Template: templates/balanced-routing.json
Best for:
Goal: Implement domain-specific routing logic
Template: templates/custom-routing-template.json
Customizable factors:
validate-routing-config.sh
test-fallback-chain.sh
generate-routing-config.sh
analyze-cost-savings.sh
Configuration Templates (JSON):
cost-optimized-routing.json - Free/cheap models with premium fallbackspeed-optimized-routing.json - Fastest models with streamingquality-optimized-routing.json - Premium models with fallbacksbalanced-routing.json - Task-based dynamic routingcustom-routing-template.json - Template for custom strategiesCode Templates:
routing-config.ts - TypeScript routing configurationrouting-config.py - Python routing configurationcost-routing-example.md - Complete cost-optimized routing setupdynamic-routing-example.md - Task complexity-based routingfallback-chain-example.md - 3-tier fallback strategymonitoring-example.md - Cost tracking and analytics setupDetermine your optimization goals:
# Interactive strategy selector
./scripts/generate-routing-config.sh
Answer questions about:
# Generate from strategy type
./scripts/generate-routing-config.sh cost-optimized > config.json
# Or copy template
cp templates/cost-optimized-routing.json config.json
# Validate syntax and model availability
./scripts/validate-routing-config.sh config.json
Checks:
# Test fallback behavior
./scripts/test-fallback-chain.sh config.json
Simulates failures to ensure graceful degradation.
# Compare routing strategies
./scripts/analyze-cost-savings.sh config.json baseline-config.json
Shows projected savings and performance tradeoffs.
{
"primary": "meta-llama/llama-3.2-3b-instruct:free",
"fallback": [
"anthropic/claude-4.5-sonnet",
"openai/gpt-4o-mini"
]
}
{
"simple_tasks": {
"models": ["google/gemma-2-9b-it:free"]
},
"medium_tasks": {
"models": ["anthropic/claude-4.5-sonnet"]
},
"complex_tasks": {
"models": ["openai/gpt-4o"]
}
}
{
"peak_hours": {
"models": ["openai/gpt-4o-mini"],
"max_latency_ms": 1000
},
"off_peak": {
"models": ["google/gemini-pro"],
"max_latency_ms": 3000
}
}
{
"free_tier": {
"models": ["meta-llama/llama-3.2-3b-instruct:free"],
"rate_limit": 10
},
"premium_tier": {
"models": ["anthropic/claude-4.5-sonnet"],
"rate_limit": 1000
}
}
google/gemma-2-9b-it:freemeta-llama/llama-3.2-3b-instruct:freemeta-llama/llama-3.2-1b-instruct:freemicrosoft/phi-3-mini-128k-instruct:freeUse for: High-volume, simple tasks, development
openai/gpt-4o-minigoogle/gemini-flash-1.5Use for: Production workloads, balanced cost/quality
anthropic/claude-4.5-sonnetopenai/gpt-4ogoogle/gemini-pro-1.5Use for: Complex reasoning, critical tasks, high quality
openai/gpt-4-vision-previewanthropic/claude-4.5-sonnet (code-specific)google/gemini-pro-1.5 (1M+ tokens)All models in fallback chain failing:
Higher costs than expected:
Quality degradation:
High latency:
See examples directory for complete implementations:
Skill Location: plugins/openrouter/skills/model-routing-patterns/
Version: 1.0.0
Supported Frameworks: Node.js, Python, TypeScript, any OpenRouter-compatible client
README.md (opens in a new tab)examples/cost-routing-example.md (opens in a new tab)examples/dynamic-routing-example.md (opens in a new tab)examples/fallback-chain-example.md (opens in a new tab)examples/monitoring-example.md (opens in a new tab)scripts/analyze-cost-savings.sh (opens in a new tab)scripts/generate-routing-config.sh (opens in a new tab)scripts/test-fallback-chain.sh (opens in a new tab)scripts/validate-routing-config.sh (opens in a new tab)templates/balanced-routing.json (opens in a new tab)templates/cost-optimized-routing.json (opens in a new tab)templates/custom-routing-template.json (opens in a new tab)templates/quality-optimized-routing.json (opens in a new tab)templates/routing-config.py (opens in a new tab)templates/routing-config.ts (opens in a new tab)templates/speed-optimized-routing.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
/openrouter-config-validatorConfiguration validation and testing utilities for OpenRouter API. Use when validating API keys, testing model availability, checking routing configuration, troubleshooting connection issues, analyzing usage costs, or when user mentions OpenRouter validation, config testing, API troubleshooting, model availability, or cost analysis./provider-integration-templatesOpenRouter framework integration templates for Vercel AI SDK, LangChain, and OpenAI SDK. Use when integrating OpenRouter with frameworks, setting up AI providers, building chat applications, implementing streaming responses, or when user mentions Vercel AI SDK, LangChain, OpenAI SDK, framework integration, or provider setup.npx claudepluginhub vanman2024/ai-dev-marketplace --plugin openrouterOther plugins' skills for the same job