-
-
Notifications
You must be signed in to change notification settings - Fork 3
Model Routing
CortexPrism edited this page Jun 17, 2026
·
1 revision
CortexPrism supports two model routing strategies that wrap LLM providers. Both implement LLMProvider, making them drop-in replacements for any provider.
Tries the cheapest provider first, escalates on low confidence.
Provider 1 (cheapest)
→ estimateConfidence(text) — multi-signal heuristic
(hedging, vagueness, repetition, specificity, length)
→ confidence < threshold?
→ Provider 2 (next cheapest)
→ ...
→ Return last result if all exhausted
{
"router": {
"enabled": true,
"strategy": "cascade",
"confidenceThreshold": 0.7,
"cascade": [
{ "provider": "ollama", "model": "llama3.2:3b" },
{ "provider": "anthropic", "model": "claude-haiku-4-5" },
{ "provider": "anthropic", "model": "claude-sonnet-4-5" }
]
}
}Scores the user's prompt before generating, then routes to strong or weak model based on complexity signals.
- Code block detection
- Question length
- Reasoning keywords
- Task-specific vocabulary
{
"router": {
"enabled": true,
"strategy": "threshold",
"confidenceThreshold": 0.5,
"threshold": {
"strongProvider": "anthropic",
"strongModel": "claude-sonnet-4-5",
"weakProvider": "ollama",
"weakModel": "llama3.2:3b",
"scorer": "heuristic"
}
}
}Available via router.getMetrics():
- Decisions per model
- Total cost and savings
- Per-model token counts
- LLM Providers — All 24 supported providers
- Model Quartermaster — Intelligent model selection with learning
- Configuration — Router config reference
CortexPrism — Open-source agentic AI harness · MIT License · Built with Deno 2.x + TypeScript