Routing Strategies
Control how the Meida arbitrage engine selects providers by passing a strategy field in your request body. If omitted, cost-latency-balanced is used by default.
Lowest Cost
"strategy": "lowest-cost"Always routes to the cheapest provider that meets the minimum quality threshold for the classified intent. Best for high-volume, cost-sensitive workloads like bulk summarization or data extraction.
Lowest Latency
"strategy": "lowest-latency"Prioritizes the fastest available provider regardless of cost. Ideal for real-time trading bots, live support interfaces, and latency-critical Web3 applications.
Cost-Latency Balanced
"strategy": "cost-latency-balanced"The default strategy. Balances cost savings with acceptable latency by scoring providers on a weighted composite of price, speed, and quality. Recommended for most applications.
Quality First
"strategy": "quality-first"Always routes to the highest-capability provider (typically Claude 3.5 Sonnet or GPT-4o) regardless of cost or latency. Use for critical tasks like smart contract audits or compliance reviews.
Usage Example
const response = await router.chat.completions.create({
model: 'auto-route',
strategy: 'lowest-cost', // Override default strategy
messages: [
{ role: 'user', content: 'Summarize this whitepaper...' }
],
});
// Check which provider was selected
console.log(response.router_telemetry.selected_provider);
// → "deepseek/deepseek-v3"