Skip to main content

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

  1. Clone the repository:
git clone https://github.com/yourusername/indoxRouter.git
cd indoxRouter
  1. 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
  1. Initialize the database:
python -m indoxRouter.init_db
  1. Run the application:
python run.py
  1. Access the application:

Docker Installation

  1. Clone the repository and configure:
git clone https://github.com/yourusername/indoxRouter.git
cd indoxRouter
cp .env.example .env
# Edit .env with your configuration
  1. Start with Docker Compose:
docker-compose up -d
  1. Access the application:

Railway Deployment

IndoxRouter is ready to be deployed on Railway. Follow these steps:

  1. Fork the repository on GitHub.

  2. Create a new project on Railway and connect it to your GitHub repository.

  3. Add the following environment variables in Railway:

    • DATABASE_URL: Your PostgreSQL connection string
    • JWT_SECRET: A secure secret key for JWT tokens
    • Provider API keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)
  4. Railway will automatically detect the Dockerfile and deploy your application.

  5. 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

  1. Register a new user through the API.
  2. Generate an API key for the user.
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indoxrouter-0.1.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

indoxrouter-0.1.0-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

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

Hashes for indoxrouter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ce5ca91793838783a84983ebb1db1113a336f6f7148e809903edeb60496720af
MD5 f34e90d47f6ad4baf18666ce504c8655
BLAKE2b-256 724dda02962475d71472901afa0589f80db1dc0a67b3b1036caaa31a06a9699f

See more details on using hashes here.

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

Hashes for indoxrouter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c30d014df0a26ccbbccbe63d5fc3340026098895c2f8070270a4e46017c97ca
MD5 a80c4812667880a466174e78b3d16f0b
BLAKE2b-256 0564b34c279b8961ab9a7ddfa0fbdbd31263bc84763444d9893a1ecedb01baf0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page