Skip to content

FluxAI is a cost optimization and observability platform for AWS Bedrock that helps companies reduce their LLM expenses by 30-50% through intelligent caching, smart routing, and real-time analytics.

License

Notifications You must be signed in to change notification settings

AgentaFlow/fluxai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FluxAI

Optimize the flow of AI

FluxAI is a cost optimization and observability platform for AWS Bedrock that helps companies reduce their LLM expenses by 30-50% through intelligent caching, smart routing, and real-time analytics.

Build and Publish Security Scan Tests Python FastAPI License Docker


πŸ“Š Project Status

βœ… Implemented Components

Component Status Documentation
API Gateway βœ… Complete Technical Spec
Semantic Cache βœ… Complete Implementation Guide
Cost Calculator βœ… Complete Calculator Guide
Observability βœ… Complete Observability Guide
Dashboard βœ… Complete Dashboard Guide
Multi-Model Router πŸ“‹ Documented Router Implementation

Implementation Summaries


πŸŽ₯ Demo Video

FluxAI Demo

Click the image above to watch our 3-minute demo showing FluxAI in action

🎯 Overview

FluxAI is a drop-in optimization layer that sits between your applications and AWS Bedrock, providing intelligent cost reduction, performance optimization, and complete observability for your LLM operations.

Key Benefits

  • πŸ’° Reduce Costs by 30-50%: Semantic caching and smart routing automatically optimize your Bedrock spending
  • πŸ“Š Complete Visibility: Real-time cost tracking, model performance metrics, and usage analytics
  • ⚑ Improve Performance: Intelligent model selection and request optimization
  • πŸ”’ Enterprise Ready: SOC 2 compliance roadmap, RBAC, audit logs, and SSO integration

πŸ’‘ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Customer Applications          β”‚
β”‚   (APIs, Chatbots, AI Agents)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          FluxAI Gateway             β”‚
β”‚  Auth | Rate Limit | Cost Track     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
     ↓        ↓        ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Semanticβ”‚ β”‚Smart β”‚ β”‚Dashboard β”‚
β”‚ Cache  β”‚ β”‚Routerβ”‚ β”‚Analytics β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚        β”‚        β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜
              ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         AWS Bedrock API             β”‚
β”‚  (Claude, Llama, Titan, Mistral)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Features

  1. 🎯 API Gateway: Drop-in replacement for Bedrock API with authentication and rate limiting
  2. πŸ’° Cost Tracking: Real-time cost calculation per request with detailed analytics
  3. 🧠 Semantic Caching: 30-50% cost reduction through intelligent response caching using AWS Bedrock Titan Embeddings
  4. πŸ”€ Smart Routing: Cost, latency, or capability-based model selection
  5. πŸ“Š Analytics Dashboard: Beautiful real-time metrics and cost insights with Streamlit
  6. πŸ”” Cost Alerts: Threshold notifications and anomaly detection
  7. πŸ” Observability: Complete monitoring with Prometheus, OpenTelemetry, and distributed tracing

πŸ“š Documentation

Getting Started

Deep Dives & Implementation Guides

Core Features:

Implementation Summaries:

API Reference

  • OpenAPI Documentation: Available at /docs when running the server
  • Cache API: GET /v1/cache/stats, DELETE /v1/cache
  • Bedrock API: POST /v1/bedrock/invoke, POST /v1/bedrock/invoke/stream
  • Analytics API: GET /v1/analytics/cost
  • Metrics API: GET /metrics (Prometheus format)

Testing & Validation

  • Testing Checklist - Comprehensive testing guide to verify all components are working correctly

πŸš€ Quick Start

Prerequisites

  • Python 3.11 or higher
  • Docker and Docker Compose (for Redis, Prometheus, PostgreSQL)
  • AWS Account with Bedrock access
  • AWS credentials configured

Installation Steps

# 1. Clone the repository
git clone https://github.com/yourusername/fluxai.git
cd fluxai

# 2. Install dependencies
pip install -r requirements.txt

# 3. Configure environment
cp .env.example .env
# Edit .env with your AWS credentials and settings

# 4. Start infrastructure services (Redis, Prometheus, PostgreSQL)
docker-compose up -d

# 5. Run the FluxAI Gateway
uvicorn app.main:app --reload

# 6. View API documentation
# Open http://localhost:8000/docs in your browser

# 7. Launch observability dashboard (optional)
# Windows PowerShell:
.\start-dashboard.ps1

# Linux/macOS:
./start-dashboard.sh

# Or manually:
streamlit run dashboard/app.py

See GETTING_STARTED.md for detailed setup instructions.


πŸ’° Cost Savings Example

Without FluxAI (Direct Bedrock)

100,000 requests/month Γ— $0.0165 per request = $1,650/month

With FluxAI (40% cache hit rate)

60,000 Bedrock requests Γ— $0.0165 = $990
40,000 cache hits Γ— $0.00005 = $2
Total: $992/month

Savings: $658/month (40% reduction)
Annual Savings: $7,896

The semantic cache uses AWS Bedrock Titan Embeddings to identify similar queries and return cached responses, providing massive cost savings with minimal latency impact.

Learn more in SEMANTIC_CACHE.md.


πŸ“„ License

See LICENSE file for details.

About

FluxAI is a cost optimization and observability platform for AWS Bedrock that helps companies reduce their LLM expenses by 30-50% through intelligent caching, smart routing, and real-time analytics.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages