Skip to content

About

Rule-based model routing for LLM requests: picks model + endpoint by task type, cost ceiling, context length.

Resources

Contributing

Stars

8 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

model-router

Rule-based model routing for LLM requests — no embeddings, no learned weights, a rules engine you can debug at 3am.

python deps license

About

Every team that runs more than one model ends up with routing logic spread across if-statements and environment variables. This replaces that with an ordered rule list that is first-match-wins and, critically, explains its decision: given a request you can print the winning rule and why every earlier rule did not apply.

No embeddings and no learned weights means the behaviour is reproducible offline and diffable in review, which is worth more than the few percent of accuracy a scorer might add.

Quick start

git clone https://github.com/lxlynx/model-router
cd model-router
python3 -m unittest -v

Configuration

Key Description
task type classification, extraction, summarisation, code
cost ceiling maximum price per 1k tokens the rule may pick
context length prompt size band, which rules out small-context models
rules file ordered, first-match-wins; print the winner with its reason

Roadmap

  • Per-provider price table refresh script
  • Dry-run mode that replays a request log
  • Metrics export of rule hit counts

Contributing

Issues and pull requests are welcome. Please keep changes small and focused, and add a test for any behaviour change — every repository here ships with a runnable test suite and no third-party dependencies, so CI is just python3 -m unittest / bash test_*.sh.

License

MIT

About

Rule-based model routing for LLM requests: picks model + endpoint by task type, cost ceiling, context length.

Resources

Contributing

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages