Basic Chat Implementation
This example shows how to implement a basic chat application using Adaptive’s API as a drop-in replacement for OpenAI.Quick Setup
Replace your OpenAI base URL with Adaptive’s endpoint:JavaScript/Node.js Example
cURL Example
Cost Comparison
Traditional OpenAI Direct:- GPT-3.5-turbo: $3.00 per 1M input tokens
- Total cost for 10K messages: ~$30
- Optimized routing: $0.10 per 1M input tokens
- Total cost for 10K messages: ~$1
- Savings: 97%
Key Features
- Drop-in Replacement: Use your existing OpenAI SDK
- Automatic Optimization: Adaptive selects the best model for each request
- Cost Savings: Typically 60-97% cost reduction
- Same Quality: Intelligent routing maintains response quality
- No Code Changes: Just update the base URL and API key
Error Handling
Next Steps
- Try the Streaming Chat Example
- Learn about Intelligent Routing
- Explore Integration Guides