Skip to main content

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

Metadata

Release files for model-router-policy-py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model-router-policy-py 0.1.0
File Size Uploaded Provenance Actions
model_router_policy_py-0.1.0.tar.gz 3.5 kB Without provenance Details for model_router_policy_py-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for model-router-policy-py 0.1.0
File Interpreter ABI Platform Actions
model_router_policy_py-0.1.0-py3-none-any.whl Python 3 none any Details for model_router_policy_py-0.1.0-py3-none-any.whl

Total release size: 7.3 kB

Release files / model_router_policy_py-0.1.0.tar.gz

Download URL model_router_policy_py-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
516d36d2363d01337c843a67e0743db0999632d45e5e84d40d44079cb8fb5412
BLAKE2b-256 checksum
How to use checksums
fc9858b124f6deb7ef219888c1530c5ce5f906e1f86af7bd85b465869f53ae48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / model_router_policy_py-0.1.0-py3-none-any.whl

Download URL model_router_policy_py-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34be790dec2476677b378a7576b98788b0cdff0cb0928fb9ead23cbbe433c5f2
BLAKE2b-256 checksum
How to use checksums
953c9cbf2cf636d721004a255f3830be370a5a6b234facaefe4b23806d257d4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for model-router-policy-py 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page