Get Your Adaptive API Key
Sign up here to create an account and generate your API key.Overview
The Vercel AI SDK works seamlessly with Adaptive through two methods:- Adaptive Provider (Recommended): Use the native
@adaptive-llm/adaptive-ai-providerprovider for built-in support. - OpenAI Provider: Use Adaptive via
@ai-sdk/openaiwith a custom base URL.
Method 1: Adaptive Provider
Installation
Basic Setup
Method 2: OpenAI Provider
Installation
Configuration
Text Generation
Streaming
React Chat Component
Configuration Parameters
Advanced configuration options are available with the Adaptive provider for intelligent routing and optimization.
Parameter Details
model_router - Intelligent Model Selection
model_router - Intelligent Model Selection
Controls intelligent model selection:
models: Array of allowed author/model strings"anthropic/claude-sonnet-4-5"- Specific model"openai/gpt-5-mini"- Specific model
cost_bias: Balance cost vs performance (0-1)0= Always choose cheapest option0.5= Balanced cost and performance1= Always choose best performance
complexity_threshold: Override automatic complexity detection (0-1)token_threshold: Override automatic token counting threshold
fallback - Provider Fallback Behavior
fallback - Provider Fallback Behavior
Controls provider fallback behavior:
enabled: Enable/disable fallback (default: true)mode: Fallback strategy"sequential"= Try providers one by one (lower cost)"race"= Try multiple providers simultaneously (faster)
semantic_cache - Semantic Caching
semantic_cache - Semantic Caching
Improves performance by caching similar requests:
enabled: Enable semantic cachingsimilarity_threshold: Similarity threshold (0-1) for cache hits- Higher values = more strict matching
- Lower values = more cache hits but less accuracy
Custom Providers
Custom providers are no longer supported. All models must be specified using the
provider:model_name string format for models available in the registry.Custom Provider Configuration
Tool/Function Calling
Cache Tier Tracking
Access cache information in the response when using the Adaptive provider:Cache Tier Information
Environment Variables
Environment Setup
Error Handling
Adaptive automatically handles provider failures and retries. For comprehensive error handling patterns, see the Error Handling Guide.What You Get
Intelligent Routing
Automatic model selection based on your prompt complexity
Built-in Streaming
Real-time response streaming with React components
Cost Optimization
Significant cost savings through smart provider selection
Provider Transparency
See which AI provider was used for each request



