Logo di Model Router

Model Router

Organizzazione
UitbreidenOS
model-router

Select optimal Claude model tier (Haiku/Sonnet/Opus) for any task using Mixture of Experts routing — 5 modes including tier classification, cascade escalation, parallel expert panel, domain routing, and budget governance

Panoramica

Pubblicato daUitbreidenOS
RepositoryUitKit
Nome della skillmodel-router
Stelle
14
Fork
5
File inclusi
Solo istruzioni
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da UitbreidenOS su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Model Router in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/UitbreidenOS/UitKit/tree/main/plugins/uitkit-ai-engineering/skills/model-router
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/UitbreidenOS/UitKit.git /tmp/UitKit
mkdir -p .claude/skills
cp -r /tmp/UitKit/plugins/uitkit-ai-engineering/skills/model-router .claude/skills/model-router
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Model Router in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Model Router non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Model Router non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Model Router — Mixture of Experts Routing

When to activate

  • User asks which Claude model to use for a task ("should I use Opus or Haiku?")
  • Optimizing cost by routing to the cheapest capable model tier
  • Building a multi-agent workflow and need to assign model tiers to subtasks
  • User mentions "MoE", "model routing", "tier selection", "cost optimization", "smart model selection"
  • Debugging a workflow where wrong model was selected for a task
  • Understanding Haiku/Sonnet/Opus capability boundaries and when to switch between them
  • Session has token budget constraints and needs dynamic routing

When NOT to use

  • Model is already explicitly specified by the user (no routing needed)
  • Single short interactive conversation where overhead exceeds benefit
  • Task is clearly Opus-only (security architecture review, threat modeling) — skip routing
  • Quality is only concern and cost is unlimited — default to Opus
  • User is asking general questions about Claude's capabilities (not task-specific routing)

Instructions

Routing Mode 1: Tier Router (Task Classification)

Analyzes task text for complexity signals — keywords, word count, domain hints.

Tier assignment logic:

  • Opus tier activated by keywords: architect, architecture, security, threat, exploit, vulnerability, design system, reasoning, planning, explore, critique, ambiguous, tradeoff, evaluate options, decide, strategy, complex decision, deep dive, analysis
  • Haiku tier activated by keywords: format, lint, rename, translate, classify, extract, boilerplate, generate stub, template, sort, list, summarize short, count, convert, reformat, cleanup, validation, parsing, simple task
  • Sonnet tier is default fallback for general-purpose work (coding, refactoring, writing, orchestration)

Confidence scoring: Higher confidence (0.7+) when multiple keywords match. Lower confidence (0.4) when task description is vague or very short.

When to use: Quick, automatic tier selection when you need to route immediately without complex reasoning.

Routing Mode 2: Cascade Escalator (Progressive Refinement)

Starts with the cheapest capable model, escalates to higher tiers only when confidence is insufficient.

Flow:

  1. Initial classification yields a tier + confidence score
  2. If confidence < threshold (default 0.65), escalate one tier up (Haiku → Sonnet → Opus)
  3. Stop at Opus or when confidence threshold is met
  4. Max escalations default to 2 (prevents runaway escalation)

When to use: Uncertain task boundaries where you'd rather start cheap and escalate as needed. Balances cost with safety.

Configuration:

  • --confidence-threshold: Re-classify at higher tier if below this (default 0.65)
  • Max escalations capped at 2

Routing Mode 3: Parallel Expert Panel (Multi-Model Voting)

Runs the same task prompt against all 3 model tiers simultaneously, aggregates results via voting.

Voting strategies:

  • Majority: Tier chosen by most experts wins (e.g., 2/3 vote for Sonnet)
  • Confidence-weighted: Score each tier by average confidence; highest-confidence tier wins
  • Synthesis: Return all 3 results for an external judge model (Sonnet) to synthesize consensus

When to use: High-stakes decisions (security designs, architecture choices) where you want consensus from diverse model strengths. Costs 3x more upfront but reduces escalation/retry risk.

Routing Mode 4: Domain Expert Router (Path-Based Routing)

Routes by file paths and task domain, without inspecting task text deeply.

Domain rules (checked in priority order):

Path PatternDomainTierReasoning
security/, auth, credentials, secrets, corsSecurityOpusHigh stakes, exploit-adjacent
architecture/, .yaml, .yml, .tfInfra/ArchitectureOpusSystem design decisions
data/, ml/, .pyData/MLSonnetComplex but not architectural
.ts, .tsx, .js, .jsxSource CodeSonnetCoding work, balanced reasoning
.md, .txtDocumentationHaikuText formatting only
(no paths provided)Task classificationPer Tier RouterFalls back to keyword analysis

When to use: Codebases with clear domain structure. Automatic routing with zero inspection overhead. Ideal for high-volume pipelines.

Routing Mode 5: Budget Governor (Token Ratio Thresholds)

Dynamically routes based on remaining token budget as a percentage of total session budget.

Thresholds:

  • If remaining / total < 15%: Force Haiku (conservation mode; preserve tokens for critical tasks)
  • If remaining / total >= 50% AND task classified as Opus: Use Opus (budget permissive)
  • Otherwise: Use Tier Router classification

Budget ratio thresholds:

  • Below 15%: "budget critical" → Haiku only
  • 15–50%: "moderate budget" → Sonnet or Haiku
  • 50%+: "budget healthy" → Any tier permitted

When to use: Long-running sessions with fixed token caps. Ensures you won't run out of tokens mid-session by auto-downgrading complexity under budget pressure.

Configuration:

  • totalBudget: Session token budget (default 100000)
  • opusThreshold: Use Opus only if >= 50% remains (default 0.5)
  • haikuThreshold: Force Haiku if < 15% remains (default 0.15)

Using the CLI

Classify a task:

bash
uitkit moe classify "format the JSON output"
# → Tier: HAIKU, Confidence: 85%, Reasoning: 2 haiku keywords detected

Show escalation path:

bash
uitkit moe cascade "design a distributed system" --confidence-threshold=0.7
# → Original Tier: SONNET, Escalations: 1, Final Tier: OPUS

Get expert panel vote:

bash
uitkit moe panel "review this code" --strategy=majority
# Shows Haiku, Sonnet, Opus opinions + voting consensus

Route by file domain:

bash
uitkit moe domain "src/security/auth.ts,src/security/jwt.ts" "security audit"
# → Domain: security, Routed Tier: OPUS

Budget-aware routing:

bash
uitkit moe budget "write unit tests" --remaining 25000 --total 100000
# → Budget Ratio: 25%, Routed Tier: SONNET (below 50% threshold but above 15%)

System status:

bash
uitkit moe status
# Prints active routing modes, thresholds, tier costs

Programmatic Usage

javascript
import MoeRouter, { classifyTask, routeByDomain, budgetGovernedRouter } from './lib/moe-router.js';

// Tier Router
const result = classifyTask('design a microservices architecture');
console.log(result.tier, result.confidence);  // claude-opus-4-7, 0.85

// Domain Router
const domainRoute = routeByDomain(['src/security/auth.ts'], 'refactor');
console.log(domainRoute.tier);  // claude-opus-4-7

// Budget Governor
const governor = budgetGovernedRouter({ totalBudget: 50000 });
const budgetRoute = governor.route('write tests', 7500);  // 15% remaining
console.log(budgetRoute.tier);  // claude-haiku-4-5 (forced)

Example

Scenario: Task is "refactor the authentication module in src/security/auth.ts". Session has 60,000 tokens remaining out of 100,000 total.

Tier Router analyzes: Keyword "refactor" suggests Sonnet → confidence 0.62

Domain Router checks: File path contains "security/" → Opus candidate → confidence high

Budget Governor sees: 60% budget remaining >= 50% threshold → Opus allowed

Decision: Domain signal overrides tier signal. Security files always route to Opus for maximum scrutiny.

Final Selection: claude-opus-4-7

CLI command:

bash
uitkit moe domain "src/security/auth.ts" "refactor the authentication module"
# → Detected Domain: security
# → Routed Tier: OPUS
# → Reasoning: security-sensitive file detected

Budget impact: At 60% budget remaining, this Opus task is acceptable. If budget had been 12% remaining, Budget Governor would force Haiku instead despite security domain (conservation mode).


Tier Reference

ModelCostSpeedReasoningWhen to Use
Haiku1xFastestLimited reasoningFormatting, classification, templating, boilerplate, simple extraction
Sonnet12xFastGood reasoningGeneral coding, refactoring, documentation, orchestration, reviews
Opus300xModerateDeep reasoningArchitecture, security, ambiguous decisions, threat modeling, complex planning

Cost note: Choosing Haiku over Opus saves ~300x on tokens for simple tasks. Cascade Escalator prevents overpaying for easy work while protecting against under-speccing hard problems.

Domande frequenti

Cosa fa la skill IA Model Router?

Select optimal Claude model tier (Haiku/Sonnet/Opus) for any task using Mixture of Experts routing — 5 modes including tier classification, cascade escalation, parallel expert panel, domain routing, and budget governance

Perché usare Model Router su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Model Router è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Model Router in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/UitbreidenOS/UitKit/tree/main/plugins/uitkit-ai-engineering/skills/model-router. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Model Router?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Model Router?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Model Router: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Model Router è gratuita?

È pubblicata su GitHub da UitbreidenOS. Consulta il repository per i termini di licenza. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇