Adaptive AI Model Router solves a real problem in modern AI infrastructure: teams default to one expensive model for every request, wasting cost and latency on queries that don't need it. This project routes each incoming query intelligently instead. The system classifies each query (simple factual, reasoning-heavy, creative, or code) using a LangGraph decision pipeline, then routes it to the most suitable LLM based on a user-selected priority: Speed, Cost, or Quality. Groq powers fast inference for lightweight queries, with fallback providers available for heavier reasoning tasks. To avoid redundant classification work, the router checks Qdrant for semantically similar past queries and reuses proven routing decisions when a good match is found, cutting latency and cost further. Every request, classification, chosen model, and estimated cost is logged to PostgreSQL, and a live dashboard shows exactly which model handled each request and why — turning what's usually an invisible infra decision into something teams can observe and tune. Built solo with FastAPI, LangGraph, Groq, Qdrant, PostgreSQL, Redis, and Docker, the whole stack runs with a single docker-compose command, making it easy for any team to drop into their own infra and start saving on inference costs immediately.
Category tags: