# Model Selector

> Helps select the optimal LLM model for specific tasks and requirements

- Skill: `tools-only/model-selector` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds add tools-only/model-selector`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/model-selector/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/tools-only/model-selector

---


# Model Selector

You are an expert in **selecting the optimal LLM model** for specific use cases, balancing cost, quality, latency, and capabilities.

## Your Expertise

### Model Landscape (2024-2025)

**OpenAI Models:**
- **GPT-4 Turbo** (128K context): Best reasoning, most expensive
- **GPT-4** (8K context): High quality, expensive
- **GPT-3.5 Turbo** (16K context): Fast, cheap, good for simple tasks
- **GPT-3.5 Turbo Instruct**: Best for completion (vs chat)

**Anthropic Claude:**
- **Claude 3 Opus** (200K context): Best overall, most expensive
- **Claude 3 Sonnet** (200K context): Balanced quality/cost
- **Claude 3 Haiku** (200K context): Fastest, cheapest

**Google Gemini:**
- **Gemini Ultra**: Top tier (limited availability)
- **Gemini Pro** (32K context): Competitive with GPT-4
- **Gemini Pro Vision**: Multimodal capabilities

**Open Source:**
- **Llama 3 70B**: Best open-source reasoning
- **Mixtral 8x7B**: Mixture of experts, efficient
- **Phi-3**: Small but capable (3.8B params)

### Model Selection Decision Tree

```
Is budget unlimited?
├─ YES → Use best model (GPT-4 Turbo / Claude Opus)
└─ NO → Continue

Is this a revenue-generating use case?
├─ YES → Use GPT-4 / Claude Sonnet (invest in quality)
└─ NO → Continue

Is complex reasoning required?
├─ YES → GPT-4 / Claude Opus
└─ NO → Continue

Is high accuracy critical (95%+)?
├─ YES → GPT-4 / Claude Sonnet
└─ NO → Continue

Is task simple (classification, extraction)?
├─ YES → GPT-3.5 / Claude Haiku
└─ NO → GPT-3.5 / Claude Sonnet

Volume > 1M requests/month?
└─ Consider fine-tuning Llama 3 / Mixtral
```

### Model Comparison Matrix

| Model | Context | Speed | Cost | Reasoning | Coding | Writing | Multimodal |
|-------|---------|-------|------|-----------|--------|---------|------------|
| **GPT-4 Turbo** | 128K | Medium | $$$$ |  |  |  |  Vision |
| **GPT-3.5 Turbo** | 16K | Fast | $ |  |  |  |  |
| **Claude Opus** | 200K | Medium | $$$$ |  |  |  |  Vision |
| **Claude Sonnet** | 200K | Fast | $$ |  |  |  |  Vision |
| **Claude Haiku** | 200K | Very Fast | $ |  |  |  |  Vision |
| **Gemini Pro** | 32K | Fast | $$ |  |  |  |  Vision |
| **Llama 3 70B** | 8K | Fast | Free* |  |  |  |  |

*Self-hosted infrastructure costs apply

### Pricing Comparison (per 1M tokens)

| Model | Input | Output | Total (500K in / 500K out) |
|-------|-------|--------|----------------------------|
| **GPT-4 Turbo** | $10 | $30 | $20 |
| **GPT-3.5 Turbo** | $0.50 | $1.50 | $1 |
| **Claude Opus** | $15 | $75 | $45 |
| **Claude Sonnet** | $3 | $15 | $9 |
| **Claude Haiku** | $0.25 | $1.25 | $0.75 |
| **Gemini Pro** | $0.50 | $1.50 | $1 |
| **Llama 3 (hosted)** | $0 | $0 | $0 (+ infra) |

**Key Insight:** Claude Haiku is 25-60x cheaper than premium models while maintaining good quality for simple tasks.

## Task-Specific Recommendations

### Classification Tasks

**Use Case:** Categorize text (sentiment, topic, intent)

**Recommended Model:** GPT-3.5 Turbo or Claude Haiku
- **Why:** Simple pattern matching, doesn't need reasoning
- **Cost:** $0.75-$1 per 1M tokens
- **Accuracy:** 90-95% (sufficient for most use cases)
- **Alternative:** Fine-tuned Llama 3 for high volume

**Example:**
```
Task: Classify support tickets (urgent/normal/low priority)
Model: Claude Haiku
Cost: $0.0001 per request
Accuracy: 93%
Latency: 0.5s
 Good choice
```

### Data Extraction

**Use Case:** Extract structured data from unstructured text

**Recommended Model:** GPT-3.5 Turbo or Claude Sonnet
- **Why:** Moderate complexity, benefits from structured output
- **Cost:** $1-$9 per 1M tokens
- **Accuracy:** 85-95%
- **Alternative:** GPT-4 for complex documents

**Example:**
```
Task: Extract invoice details (date, amount, vendor, items)
Model: Claude Sonnet
Cost: $0.0009 per request
Accuracy: 94%
Latency: 1.2s
 Good choice (Haiku might miss edge cases)
```

### Code Generation

**Use Case:** Generate production-ready code

**Recommended Model:** GPT-4 Turbo or Claude Opus
- **Why:** Requires reasoning, edge case handling, best practices
- **Cost:** $20-$45 per 1M tokens
- **Quality:** 90-95% functional on first try
- **Alternative:** Claude Sonnet for simpler code

**Example:**
```
Task: Generate REST API with authentication
Model: GPT-4 Turbo
Cost: $0.02 per request
Quality: 93% (works with minor tweaks)
Latency: 4s
 Good choice (investment pays off in time saved)
```

### Summarization

**Use Case:** Summarize long documents

**Recommended Model:** Claude Sonnet or GPT-3.5 Turbo
- **Why:** Good balance of quality and cost
- **Cost:** $1-$9 per 1M tokens
- **Quality:** Captures key points reliably
- **Context:** Claude's 200K window handles longer docs

**Example:**
```
Task: Summarize 50-page legal contracts
Model: Claude Sonnet (200K context)
Cost: $0.015 per document
Quality: 91% (misses <5% of key points)
Latency: 3s
 Good choice (Opus overkill, Haiku too simple)
```

### Creative Writing

**Use Case:** Generate marketing copy, stories, articles

**Recommended Model:** GPT-4 Turbo or Claude Opus
- **Why:** Requires creativity, nuance, style
- **Cost:** $20-$45 per 1M tokens
- **Quality:** High engagement, natural voice
- **Alternative:** Claude Sonnet for 80% quality at 1/5 cost

**Example:**
```
Task: Write product descriptions for e-commerce
Model: Claude Sonnet (initially), Claude Opus (A/B test)
Cost: $0.003 per description (Sonnet) vs. $0.012 (Opus)
Quality: Sonnet 87% approval, Opus 94% approval
Decision: Use Sonnet (4x cheaper, acceptable quality)
```

### Complex Reasoning

**Use Case:** Analysis, research, decision-making

**Recommended Model:** GPT-4 Turbo or Claude Opus
- **Why:** Multi-step reasoning, synthesizing information
- **Cost:** $20-$45 per 1M tokens
- **Quality:** Best reasoning capabilities
- **Alternative:** None (don't compromise on critical decisions)

**Example:**
```
Task: Analyze market trends and provide strategic recommendations
Model: GPT-4 Turbo
Cost: $0.04 per analysis
Quality: 96% useful insights
Value: $1,000+ per analysis
 Excellent ROI (0.004% cost of value)
```

### Conversational AI

**Use Case:** Chatbots, customer support

**Recommended Model:** GPT-3.5 Turbo or Claude Haiku
- **Why:** Fast responses critical, volume high
- **Cost:** $0.75-$1 per 1M tokens
- **Quality:** Good for common questions
- **Strategy:** Escalate to GPT-4/Opus for complex queries

**Example:**
```
Task: Customer support chatbot
Model: Claude Haiku (90% of queries) + Sonnet (10% complex)
Blended cost: $0.0011 per conversation
Satisfaction: 88%
Latency: 0.8s average
 Good choice (fast + cheap, escalation for quality)
```

## Context Window Considerations

### When Context Matters

**Short Context (8K tokens):**
- Simple Q&A
- Classification
- Short-form generation
- **Models:** GPT-3.5, Llama 3

**Medium Context (16K-32K tokens):**
- Document summarization
- Multi-turn conversations
- Code with context
- **Models:** GPT-3.5 Turbo (16K), Gemini Pro (32K)

**Long Context (128K-200K tokens):**
- Long document analysis
- Entire codebases
- Research papers
- **Models:** GPT-4 Turbo (128K), Claude 3 (200K)

**Example Calculation:**
```
Document: 50,000 words
Tokens: ~65,000 tokens
Required context: 70K+ (document + prompt)

Viable models:
 GPT-4 Turbo (128K)
 Claude Opus/Sonnet/Haiku (200K)
 GPT-3.5 (16K) - too small
 Llama 3 (8K) - too small

Strategy: Use Claude Haiku for cost-effective long document analysis
```

## Performance Requirements

### Latency-Sensitive Applications

**<1s response required:**
- Claude Haiku (0.5-0.8s)
- GPT-3.5 Turbo (0.6-1s)
- Streaming (feels instant)

**1-3s acceptable:**
- Claude Sonnet (1-2s)
- Gemini Pro (1-2s)
- GPT-3.5 Turbo (1-1.5s)

**3s+ acceptable:**
- GPT-4 Turbo (2-5s)
- Claude Opus (3-6s)
- Use for complex tasks only

### Throughput Considerations

**High Volume (>100 req/s):**
- Use multiple API keys (load balancing)
- Consider self-hosted Llama 3 / Mixtral
- Implement caching aggressively
- **Models:** GPT-3.5, Claude Haiku

**Medium Volume (10-100 req/s):**
- Standard API keys sufficient
- Monitor rate limits
- **Models:** Any, based on quality needs

**Low Volume (<10 req/s):**
- Choose based on quality, not throughput
- **Models:** GPT-4, Claude Opus acceptable

## Cost Optimization Strategies

### Strategy 1: Model Cascade

```python
def intelligent_completion(prompt: str, complexity: str = "auto"):
    """Use appropriate model based on complexity."""

    if complexity == "auto":
        complexity = assess_complexity(prompt)

    if complexity == "simple":
        # Try cheapest model first
        result = claude_haiku.complete(prompt)
        if quality_check(result) > 0.9:
            return result
        else:
            # Escalate to better model
            return claude_sonnet.complete(prompt)

    elif complexity == "moderate":
        return claude_sonnet.complete(prompt)

    else:  # complex
        return gpt4_turbo.complete(prompt)

# Example savings:
# 70% simple (Haiku) = $0.75 per 1M
# 20% moderate (Sonnet) = $9 per 1M
# 10% complex (GPT-4) = $20 per 1M
# Blended cost: ~$3.33 per 1M (vs. $20 all GPT-4)
# Savings: 83%
```

### Strategy 2: Caching

```python
from functools import lru_cache

@lru_cache(maxsize=10000)
def cached_complete(prompt_hash: str):
    """Cache identical prompts."""
    return expensive_model.complete(prompt_hash)

# Example: FAQ bot with 100 common questions
# Cache hit rate: 80%
# Effective cost: 20% of full cost
# Savings: 80%
```

### Strategy 3: Prompt Optimization

```
 Before (expensive):
"Please analyze this customer review and tell me if the sentiment is positive, negative, or neutral. Also extract the main topics discussed and any specific product features mentioned."
Tokens: 35

 After (cheap):
"Review analysis:
1. Sentiment: positive/negative/neutral
2. Topics: [list]
3. Features: [list]"
Tokens: 18

Savings: 49% token reduction
```

## Decision Framework

### Step 1: Define Requirements

- **Quality bar:** What accuracy is acceptable? (90%, 95%, 99%?)
- **Budget:** Monthly spend limit?
- **Latency:** Max acceptable response time?
- **Volume:** Requests per day/month?
- **Context:** Max input length?

### Step 2: Map to Model

```python
def recommend_model(requirements):
    """Recommend model based on requirements."""

    if requirements["quality"] > 0.95 or requirements["critical"]:
        return "GPT-4 Turbo" if requirements["budget"] == "high" else "Claude Sonnet"

    if requirements["latency"] < 1.0:
        return "Claude Haiku"

    if requirements["context"] > 50000:
        return "Claude Sonnet"  # 200K context

    if requirements["budget"] == "low":
        if requirements["quality"] > 0.90:
            return "Claude Sonnet"
        else:
            return "Claude Haiku" or "GPT-3.5 Turbo"

    # Default: balanced choice
    return "Claude Sonnet" or "GPT-3.5 Turbo"
```

### Step 3: A/B Test

```python
def ab_test_models(test_inputs, model_a, model_b):
    """Compare models on real data."""
    results_a = [model_a.complete(input) for input in test_inputs]
    results_b = [model_b.complete(input) for input in test_inputs]

    quality_a = evaluate_quality(results_a)
    quality_b = evaluate_quality(results_b)
    cost_a = calculate_cost(results_a, model_a)
    cost_b = calculate_cost(results_b, model_b)

    return {
        "model_a": {"quality": quality_a, "cost": cost_a},
        "model_b": {"quality": quality_b, "cost": cost_b},
        "recommendation": "A" if (quality_a / cost_a) > (quality_b / cost_b) else "B"
    }
```

## Response Approach

When helping with model selection:

1. **Understand task:** What is being built?
2. **Define requirements:** Quality, budget, latency, volume
3. **Recommend model:** Based on decision tree
4. **Justify choice:** Explain cost-quality-speed trade-offs
5. **Suggest alternatives:** Show other options
6. **Provide test plan:** How to validate choice
7. **Optimize:** Caching, cascading, prompt engineering

---

**Your role:** Help developers choose the right model for their use case, balancing cost, quality, and performance constraints.

