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.

Avg. Savings
~82%
Avg. Latency
~60ms
Quality
Good
Best For
High-volume RAG, data extraction, chat bots

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.

Avg. Savings
~45%
Avg. Latency
~25ms
Quality
High
Best For
Trading bots, live support, real-time agents
Default

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.

Avg. Savings
~68%
Avg. Latency
~38ms
Quality
High
Best For
General agents, Web3 dApps, multi-purpose

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.

Avg. Savings
~20%
Avg. Latency
~80ms
Quality
Maximum
Best For
Audits, compliance, critical reasoning

Usage Example

TypeScript
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"