Migrating from OpenAI SDK
This guide will help you migrate your existing OpenAI SDK (Python or Node.js) integration to use the AI Stats Gateway instead.Overview
AI Stats Gateway provides OpenAI-compatible endpoints, making migration straightforward. You’ll primarily need to:- Change the API base URL
- Update your API key
- Update authentication method (from
api_keytoAuthorization: Bearer)
Prerequisites
- An AI Stats account and API key (get one at AI Stats Dashboard)
- Existing OpenAI SDK code
Migration Steps
1. Update API Key and Base URL
Instead of using the OpenAI API key and default base URL, use your AI Stats credentials.3. Test Your Integration
Run your existing code with the updated configuration to ensure it works.4. Handle Model Names
AI Stats supports a wide range of models. Check the models endpoint for available models and their names. Some model names may differ from OpenAI’s naming convention.Common Issues
- Model not found: Ensure the model name is available in AI Stats. Use the
/modelsendpoint to list available models. - Rate limits: AI Stats may have different rate limits than OpenAI.
- Features: Some OpenAI-specific features may not be available or work differently.
Next Steps
- Explore AI Stats’ additional features like analytics and multi-provider routing.
- Check out the API Reference for full documentation.