Skip to content

ritesh-1918/AxiomAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 AxiomAI - Intelligent LLM Router

Smart prompt routing system that optimizes costs by automatically selecting between different LLM tiers based on complexity.

Live Demo Backend API License

🌟 Overview

AxiomAI is an intelligent routing system that analyzes prompt complexity and automatically routes requests to the most cost-effective LLM tier. By using ML classification and rule-based heuristics, it can reduce LLM costs by up to 70% while maintaining response quality.

✨ Key Features

  • 🎯 Smart Routing: Hybrid ML + heuristics-based classification (98% accuracy)
  • πŸ’° Cost Optimization: Automatic tier selection saves up to 70% on API costs
  • πŸ” Secure Authentication: Supabase-powered auth with email, OAuth (Google/GitHub), and OTP
  • πŸ“Š Analytics Dashboard: Real-time usage statistics and routing insights
  • ⚑ Fast API: Deployed on HuggingFace Spaces with optimized inference
  • 🌐 Chrome Extension: Route prompts directly from any AI chat interface

πŸš€ Live Deployment

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend  │─────▢│   Backend    │─────▢│   Supabase  β”‚
β”‚   (Vercel)  β”‚      β”‚ (HuggingFace)β”‚      β”‚  (Database) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  ML Classifierβ”‚
                     β”‚ (HF Inference)β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Frontend

  • Framework: Vanilla HTML, CSS, JavaScript
  • Authentication: Supabase Auth (Email, OAuth, OTP)
  • Deployment: Vercel
  • UI: Modern glassmorphism design with responsive layout

Backend

  • Framework: FastAPI (Python)
  • ML Model: Fine-tuned DistilBERT (98% accuracy)
  • Database: PostgreSQL (Supabase)
  • Deployment: HuggingFace Spaces
  • API: RESTful with auto-generated OpenAPI docs

ML Model

  • Base Model: DistilBERT-base-uncased
  • Training Data: 1,000 balanced samples
  • Accuracy: 98%
  • Inference: HuggingFace Inference API

πŸ“¦ Project Structure

AxiomAI/
β”œβ”€β”€ frontend/                 # Frontend application
β”‚   β”œβ”€β”€ index.html            # Landing page
β”‚   β”œβ”€β”€ login.html            # Authentication page
β”‚   β”œβ”€β”€ dashboard.html        # Main dashboard
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── style.css         # Styles
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   β”œβ”€β”€ auth.js           # Authentication logic
β”‚   β”‚   β”œβ”€β”€ dashboard.js      # Dashboard functionality
β”‚   β”‚   β”œβ”€β”€ charts.js         # Analytics charts
β”‚   β”‚   └── supabase.js       # Supabase client
β”‚   └── assets/               # Static assets
β”‚
β”œβ”€β”€ extension/                # Chrome extension
β”‚   β”œβ”€β”€ manifest.json         # Extension config
β”‚   β”œβ”€β”€ popup.js              # Popup logic
β”‚   └── content.js            # Content script
β”‚
└── docs/                     # Documentation
    β”œβ”€β”€ SETUP.md              # Setup guide
    └── SUPABASE_SETUP.md     # Database configuration

πŸš€ Quick Start

Prerequisites

  • Node.js (optional, for development server)
  • Supabase account
  • Modern web browser

Frontend Deployment (Vercel)

  1. Fork/Clone this repository

    git clone https://github.com/ritesh-1918/AxiomAI.git
    cd AxiomAI
  2. Deploy to Vercel

    • Connect your GitHub repo to Vercel
    • Set root directory to /
    • Deploy automatically
  3. Configure Supabase (see docs/SUPABASE_SETUP.md)

    • Create Supabase project
    • Run database schema
    • Update frontend/js/supabase.js with your credentials

Local Development

# Navigate to frontend
cd frontend

# Start local server (Python)
python -m http.server 8001

# Or use any static server
# npx serve .

Visit: http://localhost:8001

πŸ”§ Configuration

Supabase Credentials

Update frontend/js/supabase.js:

const SUPABASE_URL = 'your-project-url';
const SUPABASE_ANON_KEY = 'your-anon-key';

Backend API URL

Update frontend/js/dashboard.js:

const API_URL = 'https://ritesh1918-axiom-backend.hf.space';

πŸ“Š Features

Smart Routing

  • ML Classification: Fine-tuned DistilBERT model
  • Heuristics: Rule-based patterns for code, length, keywords
  • Confidence Scoring: Transparent routing decisions

Authentication

  • Email/Password: Standard authentication
  • OAuth Providers: Google and GitHub
  • Magic Links: Passwordless OTP login
  • Row-Level Security: Secure data access

Analytics Dashboard

  • Real-time Stats: Requests, tier distribution, latency
  • Charts: Visual routing insights
  • System Logs: Live activity monitoring
  • Cost Tracking: Estimated savings

Chrome Extension

  • One-Click Routing: Route prompts from any AI interface
  • Visual Feedback: See routing decisions instantly
  • Seamless Integration: Works with ChatGPT, Claude, etc.

🌐 API Endpoints

Backend API Documentation

Visit: https://ritesh1918-axiom-backend.hf.space/docs

Main Endpoints:

  • POST /api/v1/route - Route a prompt to appropriate LLM tier
  • GET /api/v1/stats - Get user routing statistics (requires auth)
  • GET /health - Health check

Example Request:

curl -X POST https://ritesh1918-axiom-backend.hf.space/api/v1/route \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Write a Python function"}'

Response:

{
  "selected_tier": "LARGE_LLM",
  "confidence": 0.95,
  "latency_ms": 87,
  "routing_reason": "Code generation detected"
}

🎯 Use Cases

  1. Individual Developers: Reduce personal LLM API costs
  2. Startups: Optimize infrastructure spending
  3. Enterprises: Smart routing for large-scale deployments
  4. Research: Study prompt complexity patterns
  5. Education: Learn about ML classification systems

πŸ“ˆ Performance

  • Routing Accuracy: 98%
  • Average Latency: < 100ms
  • Cost Savings: Up to 70%
  • Uptime: 99.9% (HuggingFace Spaces)

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

πŸ”— Links

πŸ‘¨β€πŸ’» Author

Ritesh

πŸ™ Acknowledgments

  • HuggingFace for model hosting and inference
  • Supabase for authentication and database
  • Vercel for frontend hosting
  • DistilBERT team for the base model

Made with ❀️ for optimizing LLM costs

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors