openrouter-routing-rules
Skill by jeremylongshore
Defines configurable routing rules for choosing OpenRouter models per request. It suits developers who need model selection based on user tier, task type, budget, or availability.
Install openrouter-routing-rules
Built from the published package, never by AI.
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-routing-rules ~/.claude/skills/openrouter-routing-rulesRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install openrouter-routing-rules in Claude Code
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-routing-rules ~/.gemini/antigravity-cli/skills/openrouter-routing-rulesAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install openrouter-routing-rules in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
The openrouter-routing-rules skill helps Claude Code build a rules engine for selecting OpenRouter models. Rules can consider user tier, task type, remaining budget, tool and vision needs, and latency SLA. Each rule has a priority, and the first matching rule by ascending priority wins. A priority 99 default rule acts as a catch-all.
Rules can be written as Python conditions or as JSON that is matched with a config helper, so they can be hot-reloaded. A routed_completion helper applies the winning rule's model, fallback chain, and max_tokens, and returns the rule name for auditing. An A/B helper sends a share of traffic to a variant model. The skill is aimed at developers running production apps on OpenRouter. It requires an OpenRouter API key and Python 3.8+ with the OpenAI SDK.
Written from the project's SKILL.md and checked against it.
What it can do
- RoutingContextModels per-request metadata such as user tier, task type, budget, and latency SLA.
- evaluate_rulesReturns the first matching routing rule, sorted by ascending priority.
- routed_completionRuns a chat completion using the winning rule's model, fallbacks, and max_tokens.
- match_config_ruleMatches a request context against JSON-defined rule conditions.
- ab_test_routingSends a configurable share of traffic to a variant model for comparison.
What you need
- OpenRouter API key exported as OPENROUTER_API_KEY
- Python 3.8+
- OpenAI Python SDK
- Budget tracking (openrouter-cost-controls) for budget-based rules
Try asking
- Set up routing rules so free users get the free Gemma model.
- Add an A/B test that sends 10% of code requests to GPT-4o.
- Show which rule and model handled each routed completion.
Good to know
- Budget-based rules such as low-budget need budget tracking set up separately.
- Example model names are hardcoded in the code samples.
- The JSON config matcher only checks exact values and list membership.
Security check
B- Allowed to use Write, Edit without limitsIn
SKILL.md
Checked automatically: skills/.curated/openrouter-routing-rules/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadWriteEditGrepBash(python3:*)
Alternatives to openrouter-routing-rules
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
openrouter-routing-rules: common questions
Does it need budget tracking to work?
Only for budget-conditioned rules such as low-budget. The source points to the openrouter-cost-controls skill for budget tracking.
How does it handle model fallbacks?
routed_completion sends the rule's model and fallbacks as a models list with route set to fallback.
Can routing rules change without a redeploy?
The source says JSON rule configs can be hot-reloaded and suggests storing rules in a config file or database.
How do I install openrouter-routing-rules?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is openrouter-routing-rules free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is openrouter-routing-rules safe to use?
It scores 76 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.
What are alternatives to openrouter-routing-rules?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
