Policy-based model routing by capability, cost, latency, and privacy. Python port of @mukundakatta/model-router-policy.
Project description
model-router-policy-py
Policy-based model routing by capability, cost, latency, and privacy. Pure Python, zero deps. Python port of @mukundakatta/model-router-policy.
pip install model-router-policy-py
from model_router_policy import route_model
models = [
{"name": "haiku", "capabilities": ["chat"], "quality": 0.7, "cost_per_1k_tokens": 0.5, "p50_latency_ms": 400, "allows_private_data": True},
{"name": "sonnet", "capabilities": ["chat", "tools"], "quality": 0.9, "cost_per_1k_tokens": 3, "p50_latency_ms": 800, "allows_private_data": True},
{"name": "opus", "capabilities": ["chat", "tools", "vision"], "quality": 0.95, "cost_per_1k_tokens": 15, "p50_latency_ms": 1500, "allows_private_data": False},
]
route_model({"required_capabilities": ["vision"], "private_data": True}, models)
# RoutingDecision(model=None, reason='no_model_satisfies_policy', ...) # opus excluded by privacy
Score weighting: quality 0.55 + cost 0.25 + latency 0.20 + preferred-cap fit 0.10/cap.
License
MIT
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 model_router_policy_py-0.1.0.tar.gz.
File metadata
- Download URL: model_router_policy_py-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
516d36d2363d01337c843a67e0743db0999632d45e5e84d40d44079cb8fb5412
|
|
| MD5 |
7a037f0657e690aba30dce0ec9171357
|
|
| BLAKE2b-256 |
fc9858b124f6deb7ef219888c1530c5ce5f906e1f86af7bd85b465869f53ae48
|
File details
Details for the file model_router_policy_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: model_router_policy_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34be790dec2476677b378a7576b98788b0cdff0cb0928fb9ead23cbbe433c5f2
|
|
| MD5 |
d59d9b9a2224e64e5a78821986e99c7d
|
|
| BLAKE2b-256 |
953c9cbf2cf636d721004a255f3830be370a5a6b234facaefe4b23806d257d4f
|