# LLMRouter

An open-source library and benchmark for routing each query to the most suitable large language model based on cost, performance, and task complexity.

LLMRouter is an open-source library for building, evaluating, and deploying systems that route each incoming query to the LLM best suited to it, rather than sending every request to the same model. It supports more than sixteen routing methods across single-round, multi-round, multimodal, agentic, and personalized categories, using techniques such as KNN, SVM, matrix factorization, Elo rating, and BERT-based classifiers.

It provides a unified command-line interface for training routers, running inference, and chatting interactively through a Gradio UI, plus a data-generation pipeline that builds training data from eleven benchmark datasets with automatic evaluation. An accompanying benchmark reports that learned routers outperform the best single fixed model by 14.6 percent while lightweight routers remain competitive under tight cost budgets.

LLMRouter is written in Python and released under the MIT license.

Website: https://ulab-uiuc.github.io/LLMRouter/
