Model Router

The Model Router automatically selects the appropriate model size based on message complexity, optimizing cost and latency.

How It Works

The router classifies each message into one of three complexity levels:

LevelDescriptionTypical Model
SIMPLEGreetings, simple questions, short responsesSmaller/faster model
MODERATEMulti-step tasks, moderate reasoningDefault model
COMPLEXCoding, deep analysis, multi-tool chainsLargest model

Classification Heuristics

The router uses several signals to determine complexity:

  1. Message length — Longer messages tend to be more complex
  2. Keyword detection — Certain words indicate complexity:
    • Code-related: “write code”, “debug”, “refactor”, “implement”
    • Analysis: “analyze”, “compare”, “explain in detail”
    • Multi-step: “step by step”, “plan”, “research”
  3. Tool mentions — References to specific tools suggest higher complexity
  4. Question depth — Follow-up questions in a chain indicate growing complexity

Threshold

A message is classified as COMPLEX if it has at least 1 complex signal AND is longer than 30 characters.

Configuration

The model router is used automatically when enabled. It works with the Claude Agent SDK and PocketPaw Native backends.

Example Classifications

MessageClassification
”Hi!”SIMPLE
”What time is it?”SIMPLE
”Write a Python web scraper that handles pagination”COMPLEX
”Analyze the performance of my database queries”COMPLEX
”Search for news about AI”MODERATE
Info

The model router is a heuristic system. For most users, the default model selection works well without the router. Enable it if you want to optimize API costs.