Python (OpenAI SDK)
Use the official OpenAI Python SDK with Eden AI to access 200+ AI models through a familiar interface.Overview
The OpenAI Python SDK is fully compatible with Eden AI’s V3 API. Simply point the SDK to Eden AI’s endpoint and you can access models from OpenAI, Anthropic, Google, Cohere, Meta, and more.Installation
Install the OpenAI Python SDK:Quick Start
Configure the OpenAI client to use Eden AI:Available Models
Access models from multiple providers using theprovider/model format:
OpenAI
openai/gpt-4openai/gpt-4-turboopenai/gpt-4oopenai/gpt-3.5-turbo
Anthropic
anthropic/claude-3-5-sonnet-20241022anthropic/claude-3-opus-20240229anthropic/claude-3-sonnet-20240229anthropic/claude-3-haiku-20240307
google/gemini-progoogle/gemini-1.5-progoogle/gemini-1.5-flash
Cohere
cohere/command-r-pluscohere/command-r
Meta
meta/llama-3-70bmeta/llama-3-8b
Multi-Turn Conversations
Build conversational applications with message history:Advanced Parameters
Control model behavior with standard OpenAI parameters:Vision Capabilities
Send images to vision-capable models:Async Support
Use async/await for concurrent requests:Error Handling
Handle API errors gracefully:Complete Example
A full example with conversation management:List Available Models
Discover available models programmatically:Environment Variables
Store your API key securely using environment variables: Use withpython-dotenv:
Troubleshooting
Authentication Errors
Ensure your API key is correct and has theBearer prefix when using raw requests:
Rate Limiting
If you hit rate limits, implement exponential backoff:Streaming Issues
Make surestream=True is set:
Next Steps
- Vision Capabilities - Working with images
- File Attachments - Uploading files
- Provider Comparison - Choosing the right model
- API Reference - Complete API documentation