litellm/litellm/router_strategy
Mateo Wang fecaf5c9e5
feat(router): tag routing denylist support via ! prefix (#31728)
Adds `!` prefix negation to tag-based routing so callers can exclude deployments by exact tag value without enumerating every allowed alternative. `!provider:anthropic` removes all deployments tagged exactly `provider:anthropic` before routing, and positive and negation tags compose. Matching is exact literal membership (frozenset intersection), so there is no regex or ReDoS surface for client-supplied tags. Ban-only requests that carry only negation tags stay within the default pool, mirroring untagged-request semantics so callers can't use negation to escape it. Fallback chains keep working because get_deployments_for_tag runs on each routing hop

Copy of #31680; implementation credit to @deepanshululla

Co-authored-by: deepanshululla <15312873+deepanshululla@users.noreply.github.com>
2026-06-30 11:00:30 -07:00
..
adaptive_router style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
auto_router style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
complexity_router style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
quality_router style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
base_routing_strategy.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
budget_limiter.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lar1_routing.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
least_busy.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lowest_cost.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lowest_latency.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lowest_tpm_rpm.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lowest_tpm_rpm_v2.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
simple_shuffle.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
tag_based_routing.py feat(router): tag routing denylist support via ! prefix (#31728) 2026-06-30 11:00:30 -07:00