Model selector
Skill onfire7777/universal-ai-skills-library/skills/model-selector
Set and manage the preferred backbone LLM for compatible AI-agent workflows. Supports manual model selection, automatic best-model selection based on task type, and a cached/refreshable leaderboard of the latest frontier models from OpenRouter. Toggle on/off via chat commands. Use when the user says "model-selector", "set model", "change model", "best model", "auto model", "switch model", "model-selector on", "model-selector off", "list models", "show models", "model status", "recommend model", "refresh models", or asks which AI model to use for a task.From its SKILL.md
npx -y skills add onfire7777/universal-ai-skills-library --skill model-selectorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.2 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
Model Selector
Control the preferred backbone LLM for compatible AI-agent workflows. Two modes: manual (user picks a specific model) or auto (dynamically selects the best model based on task category via keyword detection).
Commands
| Command | Action |
|---|---|
/model-selector set <model_id> | Set a specific model (e.g., anthropic/claude-opus-4.6). Validates against cache; warns if unknown but accepts (supports private models). |
/model-selector auto [task] | Auto-select best model. If task provided, detects category via keywords and selects top-ranked model. |
/model-selector on | Enable model selection. |
/model-selector off | Disable (the active client uses its default backbone model). |
/model-selector status | Show current config: enabled state, mode, model, reason, cache freshness. |
/model-selector refresh | Force-refresh cached model leaderboard from OpenRouter API. Rate limit: max 1 per minute. |
/model-selector list [category] | List top models by category (coding/reasoning/research/creative/math/general/all) with pricing. |
/model-selector recommend <task> | Recommend best model for a task without changing config. Shows rationale and top alternatives. |
Execution
All commands are executed by running the CLI script:
python3 scripts/model_selector.py <command> [args]
The script path is relative to this skill's directory. A common installed-skill path is:
python3 /home/ubuntu/skills/model-selector/scripts/model_selector.py <command> [args]
When a user sends a command (e.g., /model-selector auto build a website), the active AI client should:
- Parse the command and arguments from the user message.
- Invoke the CLI script via shell with the appropriate command and arguments.
- Read the script output and report the result to the user.
- For errors, display the error message and suggest remediation.
Architecture
Persistent Files
Config (~/.model_selector_config.json):
{
"enabled": true,
"mode": "manual|auto",
"manual_model": "model_id|null",
"auto_category": "category|null",
"last_selected_model": "model_id|null",
"last_selected_reason": "human-readable explanation",
"updated_at": "ISO-8601 timestamp"
}
Cache (~/.model_selector_cache.json):
{
"cached_at": 1712345678,
"cached_at_human": "ISO-8601",
"total_models": 349,
"frontier_models": [{"id": "...", "provider": "...", "context_length": 0, "price_per_m_output": 0}],
"model_lookup": {"model_id": {"id": "...", "name": "...", "context_length": 0, "pricing_prompt": "0", "pricing_completion": "0"}}
}
Task Category Detection
Auto mode classifies tasks into six categories by word-boundary regex matching: coding, reasoning, research, creative, math, or general (fallback). Each category has a curated ranking of the best models based on benchmark data. No AI classification is used — keyword detection is deterministic, fast, and credit-free. Specialized categories always win ties over "general".
Agent Integration
At the start of each task, a compatible client should:
- Read
~/.model_selector_config.json. - If
enabledistrue, note thelast_selected_modelandmode. - Use this model preference when making decisions about which LLM to invoke as the backbone.
- If
enabledisfalse, config is missing, or config is corrupted, use the client's default backbone model.
Other skills' model preferences remain unaffected.
Workflow
- Parse command from user message.
- Execute via the CLI script using shell.
- Report result — which model was selected, why, detected category (if auto), and alternatives.
- For errors: Respond with clear error message, usage help, and suggested remediation.
Error Handling
- Cache missing/corrupted: Auto-reinitialize on next use or prompt user to run
refresh. - Refresh fails: Keep stale cache, warn user, suggest retry.
- Unknown model set: Warn but accept (may be private/custom model).
- Invalid command: Show usage help with all supported commands.
- File permission errors: Suggest remediation steps.
- Config corrupted: Fall back to defaults, notify user.
- Malformed API data: Skip entries with missing IDs or non-numeric pricing gracefully.
Performance Targets
- Read-only commands (status, list, recommend): under 1 second (no network calls).
- Write commands (set, auto): under 5 seconds (may refresh cache if stale).
- Cache refresh: under 30 seconds.
- Cache auto-expires after 24 hours; refreshes on next write command.
Security
- Never expose
OPENROUTER_API_KEYin outputs, logs, or error messages. - Atomic file writes to prevent config/cache corruption.
- Preserve manual model settings unless explicitly changed by user.
Requirements
OPENROUTER_API_KEYenvironment variable (for cache refresh and model validation).requestsPython package.
Benchmark Reference
For detailed benchmark data, tier rankings, and cost analysis, read:
references/model_benchmarks.md
Only read this file when the user asks about specific benchmark data, model comparisons, or pricing details.
Constraints
- Controls backbone LLM preference only — does not alter models used by other skills.
- Uses word-boundary regex task detection exclusively — no AI classification to avoid extra costs.
- Cache refresh rate-limited: max 1 per minute, auto-refresh every 24 hours.
- Manual model settings preserved unless explicitly changed by user.
- Graceful degradation: if disabled or config/cache unavailable, the active client uses its default model.
What ships with it: 2 files
30.5 KB alongside SKILL.md, 1 of them executable
references/
- model_benchmarks.md2.8 KB
scripts/
- model_selector.pyruns27.7 KB