Welcome to RouteAI, the open-source wizard that makes API integration a breeze! Forget about those boring, tedious setups. With RouteAI, you just need a prompt, and voila! Get your payload and response served on a golden plate. It’s like having a magical butler for your APIs, ready to do all the heavy lifting while you sip your coffee and relax.
RouteAI/
│
├── api_gateway.py
├── message_queue.py
├── ai_model.py
├── endpoint_registry.py
├── load_balancer.py
├── monitor_logging.py
├── main.py
├── requirements.txt
├── payload_storage.py
├── README.md
├── test_api.py
├── utils.py
└── diff_generator.py
[Client] --> [API Gateway (FastAPI)] --> [Message Queue (Kafka-python)] --> [AI Model (OpenAI API)] --> [Dynamic Endpoint Registry (Redis)]
|
v
[Load Balancer (Traefik/NGINX configurations)]
|
---------------------------------------------------------------------------------------------------------------------------------
| | | |
[Endpoint 1] [Endpoint 2] [Endpoint 3] [Endpoint N]
Say goodbye to wasting tokens! Our diff generation feature only sends changes, making your API interactions faster and cheaper. It's like sending just the juicy bits and skipping the fluff.
RouteAI is smart enough to remember your API calls. Once it learns, it won't bug the AI model again. It just knows what to do, kind of like a well-trained pet but way cooler and more useful.
Clone the repository:
git clone <repository_url>
cd intelligent_router
Install the required dependencies:
pip install -r requirements.txt
Set up environment variables:
export OPENAI_API_KEY='your_openai_api_key'
Make sure these variables are in your .env
file:
OPENAI_API_KEY=your_openai_api_key_here
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=1
-
Start the API Gateway:
python main.py
-
Make sure Kafka and Redis services are up and running.
-
Configure and start Traefik for load balancing. (It’s not as hard as it sounds, promise!)
Want to see RouteAI in action? Use our test_api.py
script. It’s like giving RouteAI a test drive, but without the hassle of insurance.
-
Ensure the API Gateway is running:
python main.py
-
Run the test script:
python test_api.py
Watch in amazement as the script sends various payloads and prints the responses.
RouteAI learns your API calls so well, it feels like it’s reading your mind. Repeated calls are handled instantly using saved payloads. No more redundant API calls—just pure efficiency.
Send a POST request to the API Gateway with JSON data:
POST /data
Content-Type: application/json
{
"key": "value"
}
This project is licensed under the MIT License.