Adaptive’s AI-powered routing engine analyzes every request and automatically selects the optimal model from multiple providers based on complexity, cost, and performance requirements.

How It Works

1

Request Analysis

Our ML models analyze your prompt’s complexity, length, task type, and function calling requirements in real-time
2

Provider Selection

The routing engine considers available providers, costs, performance metrics, and function calling support
3

Optimal Match

The best model is selected and your request is routed automatically
4

Response Delivery

You receive a standard response with provider information showing which model was used

Quick Start

Simply leave the model field empty to enable intelligent routing:
const completion = await openai.chat.completions.create({
  model: "", // Empty enables intelligent routing
  messages: [{ role: "user", content: "Hello!" }]
});

console.log(`Used provider: ${completion.provider}`);

Real Examples

Simple Greeting

“Hello, how are you?”Routes to: Gemini Flash
Cost: $0.10 per 1M tokens
Savings: 97% vs GPT-4

Code Generation

“Write a React component…”Routes to: DeepSeek Coder
Cost: $0.34 per 1M tokens
Savings: 87% vs GPT-4

Complex Analysis

“Analyze this dataset…”Routes to: Claude Sonnet
Cost: $2.19 per 1M tokens
Savings: 72% vs GPT-4

Function Calling

“What’s the weather?” + toolsRoutes to: GPT-4o Mini
Prioritizes function calling support
Smart tool-capable model selection

Configuration Options

Function Calling Support

When tools are provided, Adaptive automatically prioritizes models with function calling capabilities:
const completion = await openai.chat.completions.create({
  model: "",
  messages: [{ role: "user", content: "What's the weather in San Francisco?" }],
  tools: [{
    type: "function",
    function: {
      name: "get_weather",
      description: "Get current weather for a location",
      parameters: {
        type: "object",
        properties: {
          location: { type: "string", description: "City name" }
        },
        required: ["location"]
      }
    }
  }]
});

// Automatically routes to models that support function calling

Control Cost vs Performance

Balance between cost savings and response quality:
const completion = await openai.chat.completions.create({
  model: "",
  messages: [{ role: "user", content: "Explain quantum physics" }],
  cost_bias: 0.3 // 0 = cheapest, 0.5 = balanced, 1 = best performance
});

Limit Available Providers

Restrict routing to specific providers or models:
const completion = await openai.chat.completions.create({
  model: "",
  messages: [{ role: "user", content: "Write a story" }],
  models: [
    { provider: "openai" }, // All OpenAI models
    { provider: "anthropic", model_name: "claude-3-sonnet" } // Specific model
  ]
});

Routing Performance

Accuracy

94% accurate model selection based on prompt analysis

Speed

<1ms routing decision time with zero added latency

Reliability

99.9% uptime with automatic failover mechanisms

Preview Routing Decisions

Want to see which model would be selected before making the request? Use our model selection preview:
// Preview which model would be selected
const response = await fetch('https://www.llmadaptive.uk/api/v1/select-model', {
  method: 'POST',
  headers: { 
    'Authorization': 'Bearer your-adaptive-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    prompt: 'Complex data analysis task',
    models: [
      { provider: 'openai' },
      { provider: 'anthropic' },
      { provider: 'deepseek' }
    ],
    cost_bias: 0.5
  })
});

const result = await response.json();
console.log(`Would select: ${result.provider}/${result.model}`);
console.log(`Alternatives: ${JSON.stringify(result.alternatives)}`);

Response Information

Every response includes provider information:
{
  "id": "chatcmpl-abc123",
  "choices": [{
    "message": {"content": "Hello! How can I help you today?"}
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  },
  "provider": "gemini",     // Which provider was selected
  "model": "gemini-flash"   // Specific model used
}

Advanced Use Cases

Enterprise Optimization

Custom provider contracts: Use intelligent routing with your own API keys and enterprise pricing

Local Deployment

On-premise inference: Get cloud-quality routing decisions for local model deployments

A/B Testing

Model comparison: Preview different routing strategies before implementing them

Cost Monitoring

Budget control: Set cost thresholds and optimize spending automatically

Best Practices

Tip: Start with cost_bias: 0.3 for most applications. This provides excellent cost savings while maintaining high quality responses.
Important: Always handle the case where no suitable model is found. The API will return an error with suggested alternatives.

Next Steps