---
name: "multi-model-fallback-cascade"
description: "Route queries to lightweight models first, escalating to frontier models only on complexity."
metadata:
  author: "RouteLLM"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "setup multi-model cascade"
  - "route query by complexity"
  - "fallback from haiku to opus"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Multi-Model Fallback Cascade & Cost Routing

Implements cost-effective model cascades: routing simple classification or extraction to small fast models (Claude Haiku, GPT-4o-mini), cascading to frontier models (Claude Opus, GPT-4o) on failure.

## When to Invoke
Invoke this skill whenever you need to:
- setup multi-model cascade
- route query by complexity
- fallback from haiku to opus

## Execution SOP & Rules
1. Classify task complexity using fast heuristic rules, token lengths, or lightweight classifier models.
2. Attempt execution with the most cost-efficient model capable of handling the task.
3. Validate output with automated schema checks; escalate to larger models if validation fails.
4. Track cost savings and latency improvements across the cascading router.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
