-
-
Notifications
You must be signed in to change notification settings - Fork 119
Model Routing
scarecr0w12 edited this page Jun 24, 2026
·
2 revisions
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 30 supported providers
- Model Quartermaster — Intelligent model selection with learning
- Configuration — Router config reference
CortexPrism — Open-source AI agent operating system · Discord · Apache 2.0 License · Built with Deno 2.x + TypeScript
- Agent Loop
- Built-in Agents
- Metacognition
- Memory System
- Skills System
- Sub-Agents
- Built-in Tools
- Code Intelligence
- Code Sandbox
- Cross-Agent Context Protocol
- Prompt Lab
- PKM Assistant
- Voice Pipeline
- Computer Use
- Browser Tool
- Git & GitHub
- Scheduler & Jobs
- Dashboard
- Observability
- A2A Protocol
- MCP Gateway
- Distributed Nodes
- Memori Checkpoints
- Eval System
- Workflow Engine
- Triggers
- Projects
- TUI
- Glossary
- Update System
- Chrome Bridge
- Swarm
- AgentLint
- Model Benchmarking
- Smart Context
- Cost Optimizer