Smart prompt routing system that optimizes costs by automatically selecting between different LLM tiers based on complexity.
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.
- π― 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
- Frontend: https://axiomai1918.vercel.app
- Backend API: https://ritesh1918-axiom-backend.hf.space
- API Docs: https://ritesh1918-axiom-backend.hf.space/docs
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Frontend βββββββΆβ Backend βββββββΆβ Supabase β
β (Vercel) β β (HuggingFace)β β (Database) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β
βΌ
ββββββββββββββββ
β ML Classifierβ
β (HF Inference)β
ββββββββββββββββ
- Framework: Vanilla HTML, CSS, JavaScript
- Authentication: Supabase Auth (Email, OAuth, OTP)
- Deployment: Vercel
- UI: Modern glassmorphism design with responsive layout
- Framework: FastAPI (Python)
- ML Model: Fine-tuned DistilBERT (98% accuracy)
- Database: PostgreSQL (Supabase)
- Deployment: HuggingFace Spaces
- API: RESTful with auto-generated OpenAPI docs
- Base Model: DistilBERT-base-uncased
- Training Data: 1,000 balanced samples
- Accuracy: 98%
- Inference: HuggingFace Inference API
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
- Node.js (optional, for development server)
- Supabase account
- Modern web browser
-
Fork/Clone this repository
git clone https://github.com/ritesh-1918/AxiomAI.git cd AxiomAI -
Deploy to Vercel
- Connect your GitHub repo to Vercel
- Set root directory to
/ - Deploy automatically
-
Configure Supabase (see
docs/SUPABASE_SETUP.md)- Create Supabase project
- Run database schema
- Update
frontend/js/supabase.jswith your credentials
# 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
Update frontend/js/supabase.js:
const SUPABASE_URL = 'your-project-url';
const SUPABASE_ANON_KEY = 'your-anon-key';Update frontend/js/dashboard.js:
const API_URL = 'https://ritesh1918-axiom-backend.hf.space';- ML Classification: Fine-tuned DistilBERT model
- Heuristics: Rule-based patterns for code, length, keywords
- Confidence Scoring: Transparent routing decisions
- Email/Password: Standard authentication
- OAuth Providers: Google and GitHub
- Magic Links: Passwordless OTP login
- Row-Level Security: Secure data access
- Real-time Stats: Requests, tier distribution, latency
- Charts: Visual routing insights
- System Logs: Live activity monitoring
- Cost Tracking: Estimated savings
- One-Click Routing: Route prompts from any AI interface
- Visual Feedback: See routing decisions instantly
- Seamless Integration: Works with ChatGPT, Claude, etc.
Visit: https://ritesh1918-axiom-backend.hf.space/docs
Main Endpoints:
POST /api/v1/route- Route a prompt to appropriate LLM tierGET /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"
}- Individual Developers: Reduce personal LLM API costs
- Startups: Optimize infrastructure spending
- Enterprises: Smart routing for large-scale deployments
- Research: Study prompt complexity patterns
- Education: Learn about ML classification systems
- Routing Accuracy: 98%
- Average Latency: < 100ms
- Cost Savings: Up to 70%
- Uptime: 99.9% (HuggingFace Spaces)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Live Demo: axiomai1918.vercel.app
- Backend API: ritesh1918-axiom-backend.hf.space
- Documentation: docs/SETUP.md
- GitHub: github.com/ritesh-1918/AxiomAI
Ritesh
- GitHub: @ritesh-1918
- Email: ritesh1918@users.noreply.github.com
- 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