model-selection
Automatically applies when choosing LLM models and providers. Ensures proper model comparison, provider selection, cost optimization, fallback patterns, and multi-model strategies.
npx skills add majiayu000/claude-skill-registry --skill model-selection-majiayu000-claude-skill-registr --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Automates and documents the process of selecting LLM models and managing providers. It codifies model registry patterns, routing rules, fallback chains, cost optimization, and multi-model ensembles to balance cost, performance, and reliability.
How it works
- Defines a ModelProvider enum and models metadata (id, name, provider, capabilities, pricing, recommended_use_cases, quality_tier).
- Builds a ModelRegistry that registers default models (e.g., Claude Sonnet 4, Claude Haiku 3.5, GPT-4 Turbo) with their capabilities and pricing.
- Provides a find_by_criteria method to filter models by max_cost_per_mtok, min_context_tokens, requires_streaming, requires_vision, quality_tier, and provider, then sorts results by input_price_per_mtok (cheapest first).
- Implements a ModelRouter with add_rule and route to select a model_id based on prompt-based conditions and priority, with a default fallback to claude-sonnet-4-20250514.
- Includes a FallbackChain that tries a primary model first and iterates through fallback_models, obtaining a client per provider and performing complete calls, returning response, model_used, and whether a fallback occurred.
- Contains a CostOptimizer to estimate costs (input/output tokens) from the registry and to find the cheapest model meeting criteria; supports batch_cost_analysis over multiple requests and models.
- Describes a Multi-Model Ensemble structure (incomplete snippet) intended to ensemble outputs from several models with a voting strategy.
When to use it
- Use when you need to programmatically choose models/providers based on cost, context window, capabilities, or tier; when you want to route prompts to specific models by task, or implement fallback behavior for reliability.
- Use cost optimization features when your goal is to minimize USD per request while meeting capability requirements; use the fallback chain to improve reliability when a primary model fails.
What it can touch
- The code interacts with a ModelRegistry containing models and their pricing/capabilities.
- It uses a ModelRouter that references the registry to route to a model_id.
- It references clients for providers (e.g., anthropic, openai) to perform complete calls in the fallback flow.
- It computes costs via the Pricing data in the registry.
Caveats
- The registry includes a limited default model set (Claude Sonnet 4, Claude Haiku 3.5, GPT-4 Turbo) as shown; more models would require registration.
- The example usage and classes assume specific method names (e.g., complete, provider.value) and structures; real integration must supply matching client interfaces.
- Some sections (e.g., Multi-Model Ensemble) are incomplete in the snippet and may require implementation details not provided here.
# Model Selection and Provider Management When selecting LLM models and managing providers, follow these patterns for optimal cost, performance, and reliability. **Trigger Keywords**: model selection, provider, model comparison, fallback, OpenAI, Anthropic, model routing, cost optimization, model capabilities, provider failover **Agent Integration**: Used by `ml-system-architect`, `performance-and-cost-engineer-llm`, `llm-app-engineer` ## ✅ Correct Pattern: Model Registry ```python from typing import Optional, Dict, List from pydantic import BaseModel, Field from enum import Enum class ModelProvider(str, Enum): """Supported LLM providers.""" ANTHROPIC = "anthropic" OPENAI = "openai" GOOGLE = "google" LOCAL = "local" class ModelCapabilities(BaseModel): """Model capabilities and constraints.""" max_context_tokens: int max_output_tokens: int supports_streaming: bool = True supports_function_calling: bool = False supports_vision: bool = False supports_json_mode: bool = False class ModelPricing(BaseModel): """Model pricing information.""" input_price_per_mtok: float # USD per million tokens output_price_per_mtok: float cache_write_price_per_mtok: Optional[float] = None cache_read_price_
- ✅ Correct Pattern: Model Registry
- Model Router
- Fallback Chain
- Cost Optimization
- Multi-Model Ensemble
- ❌ Anti-Patterns
- Best Practices Checklist
- Auto-Apply
- Related Skills
What does the model-selection skill do?
Automatically applies when choosing LLM models and providers. Ensures proper model comparison, provider selection, cost optimization, fallback patterns, and multi-model strategies.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill model-selection-majiayu000-claude-skill-registr --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
