openrouter-model-routing

Featured

Implement intelligent model routing to optimize cost, quality, and latency on OpenRouter. Use when building multi-model systems or optimizing spend across task types. Triggers: 'openrouter routing', 'model routing', 'route to model', 'model selection openrouter'.

AI & Automation 2,940 stars 439 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# OpenRouter Model Routing ## Overview OpenRouter gives you access to 100+ models through one API. The key to cost efficiency is routing each request to the right model based on task complexity, required capabilities, cost budget, and latency requirements. This skill covers task-based routing, complexity classification, cost-aware selection, and OpenRouter's native routing features. ## Task-Based Router ```python import os, re from openai import OpenAI client = OpenAI( base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"], default_headers={"HTTP-Referer": "https://my-app.com", "X-Title": "my-app"}, ) # Model tiers by cost and capability MODELS = { "free": "google/gemma-2-9b-it:free", # $0/0 — testing only "budget": "meta-llama/llama-3.1-8b-instruct", # $0.06/$0.06 per 1M "mid": "openai/gpt-4o-mini", # $0.15/$0.60 per 1M "standard":"anthropic/claude-3.5-sonnet", # $3/$15 per 1M "premium": "openai/o1", # $15/$60 per 1M } TASK_ROUTING = { "classification": "budget", # Simple label assignment "translation": "mid", # Moderate quality needed "summarization": "mid", # Good quality, cost-effective "code_generation": "standard", # Needs high accuracy "code_review": "standard", # Needs reasoning "analysis": "standard", # Complex reasoning "creative_writing":"standard", # Quality matters "de...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category