Python routing library for local LLM agent loops: score prompts, map tiers to model names, embed in your runner.
Project description
local-llm-router
A Python routing library for local LLM agent loops.
Give local-llm-router a prompt and your model list. It returns a complexity tier and which model to call. You keep your agent runner, gateway, or Ollama client — local-llm-router only decides which local model each step should use.
Zero runtime dependencies. Works offline. No inference, no agent framework, no chat UI.
Install
pip install local-llm-router
pip install "local-llm-router[ollama]" # optional: Ollama discovery, llm-router ask
Quick start
import local_llm_router
local_llm_router.configure(vram_gb=16, quant="qat") # once — or local_llm_router_VRAM_GB=16
for step in agent_steps:
tier, model = local_llm_router.route(step.prompt, hint=step.hint)
response = your_llm.complete(model=model, prompt=step.prompt)
Power-user path (explicit tier map):
from local_llm_router import assign_tiers, route_prompt
tiers = assign_tiers(["gemma4:e4b", "qwen3:8b", "qwen3:14b"])
tier, model = route_prompt(step.prompt, tiers, hint=step.hint)
Check your stack before routing:
llm-router doctor --check-stack --vram-gb 16 --quant qat
Integration guide: docs/for-app-authors.md · docs/integration.md
What it does
| Piece | Role |
|---|---|
configure(vram_gb=..., quant=...) |
Set GPU budget + Gemma quant assumption once |
route(prompt, hint=...) |
Pick (tier, model_name) for one agent step |
assign_tiers / route_prompt |
Same routing with your own tier map |
llm-router compare / stack benchmark |
CLI evidence — dry by default |
Step hints: lookup, explain, design, code, reason — override keyword scoring when you know the agent phase.
VRAM and quant
local_llm_router.configure(vram_gb=16, quant="qat")
| VRAM | Profile |
|---|---|
| ≤8 / 12 / 16 / 24 / 32 GB | workstation_8gb … workstation_32gb |
quant= is not per-prompt routing — it tells local-llm-router which pull format you use so VRAM filters and stack suggestions stay honest (QAT vs default Ollama Q4). Details: docs/local-models.md.
What it is not
Routing primitives only — not a chat app, agent framework, or multi-cloud proxy. Optional browser demo and VS Code panel are examples, not the product.
Examples (optional)
Clone the repo only if you want demos or to contribute:
| Example | Command |
|---|---|
| Agent runner | python examples/agent_runner/run.py |
| Compare POC | llm-router compare |
| Browser demo | python examples/demo_ui/server.py → http://127.0.0.1:8765 |
| Quickstart tour | examples/quickstart/try_it.ps1 |
See examples/*/README.md for each.
Contributors
git clone https://github.com/edwardjbaumel/local-llm-router.git
cd local-llm-router
pip install -e ".[dev,ollama]"
pytest
llm-router setup --profile 12gb --dry-run
Docs: docs/publishing.md · docs/security.md · docs/backlog.md
Related
Local Recruiting Ops — separate project by the same author; local-llm-router does not depend on it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file local_llm_router-0.4.1.tar.gz.
File metadata
- Download URL: local_llm_router-0.4.1.tar.gz
- Upload date:
- Size: 52.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3cd05d56235b7a02f81a8847243355488773bc14b7541e1959ab0f36b784d7
|
|
| MD5 |
a03dbe4355ef51d3a957064cc0f069c3
|
|
| BLAKE2b-256 |
49477951fead641628cefd1f79e35a4dbea435f0bdf4e51de56a4f1b54bc5ac9
|
File details
Details for the file local_llm_router-0.4.1-py3-none-any.whl.
File metadata
- Download URL: local_llm_router-0.4.1-py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65fa3837ffa045283f6b0240818c09dd8a47fe2d729f48e5b12fda1cb51ae7c1
|
|
| MD5 |
d0236fbc13c16be7f45ce795309e8658
|
|
| BLAKE2b-256 |
8792045f3f67060ff9edc0a9bd4950cfb9231184f6534a0dff6aa704bffcfe35
|