Skip to content

Auto Routing

TokenRouter automatically selects the best AI provider for each request based on cost, quality, latency, and availability.

  1. Analyzes Request - Input length, complexity, features needed
  2. Scores Providers - Based on your routing mode
  3. Applies Rules - Custom routing and firewall rules
  4. Selects Provider - Optimal choice
  5. Routes Request - Sends to provider
  6. Returns Response - With routing metadata

Use auto:* for automatic provider selection:

model: 'auto:balance' // Default: balanced optimization
{
"metadata": {
"provider": "openai",
"routing_mode": "balance",
"routing_confidence": 0.95
}
}