Office Hours — How do I route inference between cheaper and more capable models without tanking quality or costs? A daily developer question about AI/LLMs, answered with a direct, opinionated take. 2026-11-27T12:00:00.000Z Office Hours Office Hours office-hoursq-and-apractical-ai

Office Hours — How do I route inference between cheaper and more capable models without tanking quality or costs?

A daily developer question about AI/LLMs, answered with a direct, opinionated take.

Daily One question from the trenches, one opinionated answer.

How do I route inference between cheaper and more capable models without tanking quality or costs?

This is the question that keeps infrastructure engineers up at night once you’re running LLMs at scale. You’ve got GPT-6 Luna at $0.10/$0.50 per M tokens looking tempting for high-volume work, but you’re terrified it’ll botch a customer-facing task. Meanwhile, GPT-6.2 Astra at $10/$50 per M is reliable but burns through your budget like you’re funding a small country’s research lab.

The trap most teams fall into is binary thinking: pick one model and hope. The reality is messier and more economical.

The Architecture Decision: Classify Before You Route

Your first move is accepting that not every request needs your smartest model. A good routing layer asks: what’s the actual complexity of this task? If you’re summarizing a support ticket, extracting a name from a form, or classifying intent, Claude Haiku 5.5 at $0.10/$0.50 per M can handle it. If you’re debugging a multi-step system design problem or reasoning through ambiguous requirements, you need Claude Fable 5.2 or GPT-6.2 Astra.

The key is measuring what “tanking quality” actually means for your workload. At Databricks, they benchmarked their open-source GLM-5.2 against Claude Opus 4.8 on their production codebase and found GLM-5.2 matched quality while cutting per-task costs from $1.94 to $1.28. The real insight wasn’t that GLM-5.2 is secretly as good as Opus—it’s that their specific task set didn’t need Opus-tier reasoning. Know your own work before you assume you need the flagship.

The Routing Pattern

Here’s a concrete implementation pattern:

class ModelRouter:
    def route(self, task: str, context_complexity: int) -> tuple[str, dict]:
        """Route to appropriate model based on task characteristics."""
        
        # Simple classification tasks → cheapest tier
        if task in ["classify_intent", "extract_structured_data", "simple_summarization"]:
            if context_complexity < 2000:  # tokens
                return "claude-haiku-5-5", {"max_tokens": 256}
            else:
                return "claude-sonnet-5-5", {"max_tokens": 512}
        
        # Reasoning and ambiguous judgment → mid-tier
        elif task in ["debug_code", "audit_decision", "content_review"]:
            return "claude-opus-5-5", {"max_tokens": 2048}
        
        # Hard reasoning, long horizon, novel problems → frontier
        elif task in ["system_design", "research_synthesis", "novel_problem_solving"]:
            return "claude-fable-5-2", {"max_tokens": 4096}
        
        # Fallback to safe choice
        return "claude-opus-5-5", {"max_tokens": 1024}

This isn’t overthinking it. You’re not building a machine-learning classifier. You’re explicitly mapping task types to models based on what you’ve measured in your own workload. The overhead is minimal; the savings compound fast.

The Fallback Trap

Here’s where most routing systems fail in production: you route to Haiku, it fails silently, and you either retry with Opus (burning tokens and cascading costs) or accept the failure. Neither is acceptable.

Build a confidence score into your responses. Claude Opus 5.5 and Fable 5.2 include adaptive thinking by default, which means you get structured reasoning traces. Use that signal. If your routed model returns a result with low confidence markers (“I’m not certain”, “this requires clarification”), re-route to a stronger model immediately without burning the full token budget on a failed attempt.

response = client.messages.create(
    model=routed_model,
    messages=[{"role": "user", "content": prompt}]
)

# Check if the model flagged uncertainty
if has_low_confidence_markers(response.content):
    # Re-route to stronger model, but don't repeat the full work
    response = client.messages.create(
        model="claude-fable-5-2",
        messages=[
            {"role": "user", "content": prompt},
            {"role": "assistant", "content": response.content[0].text},
            {"role": "user", "content": "Review your previous response. Were you uncertain?"}
        ]
    )

This is cheap insurance. You’re not retrying blindly; you’re using the model’s own reasoning to decide when to escalate.

The Real Cost Math

Nvidia’s research on this is brutal: massive context windows waste computation. If you’re routing based on raw prompt size alone, you’re probably routing wrong. A 100K-token prompt to Haiku on a simple classification is wasteful. A 2K-token ambiguous judgment call to Opus is correct.

Look at cached tokens. If you’re repeatedly routing the same system prompt or instructions to multiple models, you’re leaking money. Set up prompt caching at the router level, then route the incremental query. With claude-opus-5-5, cached reads cost $0.20/M—95% off the base rate. With GPT-6 Luna, the discount is similar. Reuse aggressively.

# Cache the system prompt once, route individual queries
system_prompt = "You are a support ticket classifier..."
cached_system = client.beta.cache.create(
    messages=[{"role": "user", "content": system_prompt}]
)

for ticket in tickets:
    model = router.route(ticket)
    response = client.messages.create(
        model=model,
        messages=[
            {"role": "user", "content": ticket.text}
        ],
        system=[{"type": "text", "text": system_prompt, "cache_control": {"type": "ephemeral"}}]
    )

The Real Failure Mode

The gap between benchmark performance and real-world reliability is massive. Clay’s GTM agent team found that model selection frustrates customers far less than latency and reliability. Cheaper models are fine as long as they’re fast and predictable. It’s the timeout or the silent failure that breaks workflows.

This means your routing system needs observability built in from day one. Log which model handled which task, what its confidence was, whether it succeeded, and how long it took. After two weeks of production traffic, you’ll have real data on what actually works in your workload. That’s when you stop guessing.

Bottom line: Route explicitly by task type, not by model preference or cost alone. Use low-confidence signals to escalate without retrying, cache aggressively at the router level, and measure your actual quality-to-cost ratio in production. You’ll save 40–60% on inference costs without hurting reliability.