NadirClaw uses a binary classifier built on sentence embeddings to decide whether a prompt is simple or complex. Classification adds roughly 10ms of overhead per request.
How it works
By default, NadirClaw routes across two tiers:
- Simple -- routed to your cheap model (e.g. Gemini Flash, GPT-4o Mini)
- Complex -- routed to your premium model (e.g. Claude Sonnet, GPT-4o)
Set NADIRCLAW_CLASSIFIER=cascade and add a NADIRCLAW_MID_MODEL to enable optional 3-tier routing with a mid-range model in between.
Routing modifiers
Beyond the base classifier, NadirClaw applies a set of heuristic modifiers that override or adjust the routing decision:
Agentic detection
Tool-use calls, agent system prompts, or conversations with more than 10 messages are automatically routed to the complex model.
Reasoning detection
Prompts containing phrases like "step by step", "think carefully", or "reason through" are routed to the reasoning model when configured.
Vision routing
Requests containing image content parts are automatically detected and routed to a vision-capable model.
Session persistence
Multi-turn conversations stick to the same model for the entire session (30-minute TTL) to maintain consistency.
Context window filtering
If a prompt exceeds a model's context window, NadirClaw automatically selects a model with a larger window.
Test the classifier
Use the CLI to see how NadirClaw would classify a prompt without making an actual LLM call:
nadirclaw classify "Explain the tradeoffs between microservices and monoliths" # Output: # Tier: complex # Confidence: 0.91 # Model: claude-sonnet-4-20250514 # Modifiers: none
Routing profiles
Set model in your request to one of these profile names to override the default routing behaviour:
| Profile | Behaviour |
|---|---|
auto | Default -- classifier decides (simple or complex) |
eco | Always route to the simple model |
premium | Always route to the complex model |
free | Route to the free model |
reasoning | Route to the reasoning model |
Model aliases
For convenience, NadirClaw recognises short aliases for popular models:
| Alias | Model |
|---|---|
sonnet | claude-sonnet-4-20250514 |
opus | claude-opus-4-20250514 |
haiku | claude-3-5-haiku-20241022 |
gpt4 | gpt-4o |
gpt5 | gpt-5 |
flash | gemini-2.0-flash |
gemini-pro | gemini-2.5-pro |
deepseek | deepseek-chat |
llama | llama-3.3-70b |