Client library for IndoxRouter - A unified API for multiple LLM providers
Project description
IndoxRouter
A unified API for multiple LLM providers, allowing you to switch between different models seamlessly.
Features
- Support for multiple providers (OpenAI, Anthropic, Mistral, Cohere, Google, Meta, AI21, Llama, NVIDIA, Deepseek, Databricks)
- Unified API for all providers
- User authentication and API key management
- Request logging and monitoring
- Docker support for easy deployment
- Ready for Railway deployment
Quick Start
Local Installation
- Clone the repository:
git clone https://github.com/yourusername/indoxRouter.git
cd indoxRouter
- Create a virtual environment and install dependencies:
python -m venv venv
# On Windows
venv\Scripts\activate
# On Unix or MacOS
source venv/bin/activate
pip install -r requirements.txt
- Initialize the database:
python -m indoxRouter.init_db
- Run the application:
python run.py
- Access the application:
- API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Docker Installation
- Clone the repository and configure:
git clone https://github.com/yourusername/indoxRouter.git
cd indoxRouter
cp .env.example .env
# Edit .env with your configuration
- Start with Docker Compose:
docker-compose up -d
- Access the application:
- API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- pgAdmin: http://localhost:5050
Railway Deployment
IndoxRouter is ready to be deployed on Railway. Follow these steps:
-
Fork the repository on GitHub.
-
Create a new project on Railway and connect it to your GitHub repository.
-
Add the following environment variables in Railway:
DATABASE_URL: Your PostgreSQL connection stringJWT_SECRET: A secure secret key for JWT tokens- Provider API keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)
-
Railway will automatically detect the Dockerfile and deploy your application.
-
Once deployed, you can access your API at the URL provided by Railway.
Detailed Documentation
For detailed deployment instructions, configuration options, and troubleshooting, please refer to the Deployment Guide.
API Usage
Authentication
- Register a new user through the API.
- Generate an API key for the user.
- Use the API key in your requests.
Making Requests
import requests
api_key = "your_api_key"
url = "http://localhost:8000/v1/completions"
payload = {
"provider": "openai",
"model": "gpt-3.5-turbo",
"prompt": "Hello, world!",
"temperature": 0.7,
"max_tokens": 100
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Client Library
IndoxRouter includes a Python client library for easy integration:
from indoxRouter.client import Client
client = Client(api_key="your_api_key")
response = client.completions(
provider="openai",
model="gpt-3.5-turbo",
prompt="Hello, world!",
temperature=0.7,
max_tokens=100
)
print(response)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indoxrouter-0.1.0.tar.gz.
File metadata
- Download URL: indoxrouter-0.1.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce5ca91793838783a84983ebb1db1113a336f6f7148e809903edeb60496720af
|
|
| MD5 |
f34e90d47f6ad4baf18666ce504c8655
|
|
| BLAKE2b-256 |
724dda02962475d71472901afa0589f80db1dc0a67b3b1036caaa31a06a9699f
|
File details
Details for the file indoxrouter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: indoxrouter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 42.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c30d014df0a26ccbbccbe63d5fc3340026098895c2f8070270a4e46017c97ca
|
|
| MD5 |
a80c4812667880a466174e78b3d16f0b
|
|
| BLAKE2b-256 |
0564b34c279b8961ab9a7ddfa0fbdbd31263bc84763444d9893a1ecedb01baf0
|