Skip to main content

One interface for resilient, multi-provider AI generation.

Project description

██████╗ ██████╗  █████╗ ██╗
██╔══██╗██╔══██╗██╔══██╗██║
██████╔╝██║  ██║███████║██║
██╔══██╗██║  ██║██╔══██║██║
██║  ██║██████╔╝██║  ██║██║
╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝
  

🚀 rdai (Ranajit Dhar AI) - Multi-Brain AI Orchestrator

One Interface. Any AI. Unbreakable Auto-Failover.

Version: v1.0.0
👑 Created by: Ranajit Dhar
🌐 Website: https://ranajitdhar.in

rdai is a Quantum-Ready, Self-Healing AI Operating System and Python SDK. It allows you to call multiple AI models (Gemini, OpenAI, Claude, DeepSeek, and more) through one single, unified interface. It automatically discovers your API keys, selects the best provider based on your strategy, and features a limitless Circuit Breaker that silently auto-failovers to a backup provider when rate limits, crashes, or timeouts occur.

Zero downtime. 100% Reliability.


✨ Key Features

  • 🧠 11+ Built-in AI Brains: Native support for Gemini, OpenAI, Groq, Claude, DeepSeek, Qwen, Llama, Mistral, VertexAI, AWS Bedrock, and HuggingFace.
  • Unbreakable Auto-Failover: If your primary model crashes or hits a rate limit, the system instantly and silently routes the prompt to the next available model.
  • 🛠️ Bring-Your-Own-Model (BYOM): Inject any custom/private AI API into the failover chain without changing the core framework.
  • 🩺 Live Ping Diagnostics: The built-in CLI doctor actually pings the AI servers to report real-time ALIVE/ERROR status and latency.
  • 🪄 Smart Auto-Setup: Automatically installs missing required SDKs in the background during initialization. Prevents accidental configuration overwrites.

📦 Installation

pip install rdai
# Or if using local source: pip install -r requirements.txt

🚦 Quick Start (The CLI Wizard)

rdai comes with a powerful CLI dashboard. To configure your multi-brain environment, simply run:

rdai init

This interactive wizard will let you select your AI providers, define your failover strategy, auto-install missing packages, and generate your .env and rdai.yaml files.

Next, add your API keys to the generated .env file:Code snippet

GEMINI_API_KEY=your_key_here
GROQ_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
# Add others as selected...

(Note: Your API keys are kept strictly local and secure. They are never hardcoded.)

Finally, verify your setup with the live diagnostic tool:

rdai doctor

The doctor will scan your .env file, ping the AI networks, and show you the real-time latency and health of your failover chain.


💻 Python SDK Usage (Writing Code)

Using the SDK is incredibly simple. You don't need to learn 10 different SDKs; rdai standardizes everything.

from rdai import AI

# Initialize the AI Engine. It automatically loads your rdai.yaml strategy.
ai = AI()

# Send a prompt. If the first model fails, it silently falls back to the next!
response = ai.generate("Write a multi-agent orchestration script in Python.")
print(response)

Bring Your Own Model (BYOM)

Want to use a custom API? Inject it directly into the engine:

from rdai.providers.base import BaseProvider
from rdai import AI
import requests

class CustomNexusProvider(BaseProvider):
    def __init__(self, api_key):
        super().__init__(api_key, "nexus-v1")
        
    def generate(self, prompt: str, **kwargs) -> str:
        res = requests.post("[https://api.nexus.com/v1](https://api.nexus.com/v1)", headers={"Key": self.api_key}, json={"text": prompt})
        return res.json()["reply"]

# Inject your custom engine into the failover chain!
ai = AI(providers=[CustomNexusProvider(api_key="your_custom_key")])
print(ai.generate("Hello Custom Engine!"))

⚙️ Routing Strategies & Configuration

rdai reads your setup from an optional rdai.yaml file in the current directory. Environment variables take precedence over values in .env

strategy: smart
provider_order:
  - gemini
  - openai
  - groq

🧠 Routing Strategies

  • smart: Selects a ready provider whose traits best fit the specific request.
  • manual: Strictly follows the exact provider_order defined in your rdai.yaml.

Note: Both strategies retain the remaining ready providers as automatic fallbacks for transient rate-limit and timeout failures.


🎛️ Supported AI Engines & Environment Keys

Provider Engine Environment Variable Backend Logic
Gemini GEMINI_API_KEY Modern google.genai SDK
OpenAI OPENAI_API_KEY Official openai SDK
Groq GROQ_API_KEY Official groq SDK
VertexAI VERTEXAI_API_KEY GCP Project ID via google.genai
Claude CLAUDE_API_KEY Direct Anthropic REST API
AWS Bedrock AWS_BEDROCK_API_KEY AWS boto3 SDK
DeepSeek DEEPSEEK_API_KEY Direct DeepSeek REST API
Qwen QWEN_API_KEY Alibaba DashScope REST API
Llama LLAMA_API_KEY Universal OpenAI-Compatible API
Mistral MISTRAL_API_KEY Direct Mistral REST API
HuggingFace HUGGINGFACE_API_KEY HF Serverless Inference API

🛠️ Complete CLI Command Reference

  • rdai init - Setup your workspace, strategies, and AI providers.
  • rdai doctor - Run a live .env network scan and API health check.
  • rdai config - View your active routing strategy and failover chain.
  • rdai benchmark - Run a latency test across your active models.
  • rdai health - Check overall internal system health and readiness.
  • rdai about - Learn about the master orchestration architecture.

Built with ❤️ for the next generation of unbreakable AI applications.

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

rdai-1.0.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

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

rdai-1.0.0-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file rdai-1.0.0.tar.gz.

File metadata

  • Download URL: rdai-1.0.0.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.0

File hashes

Hashes for rdai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9dc1a8f12d4b484ad09a4ea9849f38c8a137f32b8628d685d870c7b2f517678c
MD5 ea6fde45e5a5d42f69e83c299637636b
BLAKE2b-256 7b9e2cc45979e54c8c959bc3bcf4b18e698fa8ba3a2af76a44630171fd104c5e

See more details on using hashes here.

File details

Details for the file rdai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rdai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.0

File hashes

Hashes for rdai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e16734f522105f15f3e5fd0ad5564d34462cec5d508d8cd59b5baafff7401126
MD5 0b10bae127fda82110aa5f44c0b5182a
BLAKE2b-256 8a264b5be2848447bb2fd85055cb7013179114268d8bc87daa69e6a5951b9718

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