BerriAI/litellm · error · ValueError
LAR-1 thresholds must satisfy 0 < low < medium < high < 1, g
Error message
LAR-1 thresholds must satisfy 0 < low < medium < high < 1, got low={low}, medium={medium}, high={high} What it means
Config validation in LAR-1 routing: the low/medium/high latency thresholds merged from routing_strategy_args must be strictly increasing within (0,1); the supplied values violate that ordering, so the strategy cannot bucket latencies.
Source
Thrown at litellm/router_strategy/lar1_routing.py:62
def apply_lar1_routing_strategy(
router: Router,
routing_strategy_args: Mapping[str, object] | None = None,
) -> None:
strategy: Final = LAR1RoutingStrategy(
router_instance=router,
thresholds=lar1_thresholds_from_args(routing_strategy_args),
)
router.routing_strategy = "lar1"
router.set_custom_routing_strategy(strategy)
def _normalize_thresholds(thresholds: dict[str, float] | None) -> dict[str, float]:
merged: Final = {**DEFAULT_THRESHOLDS, **(thresholds or {})}
low: Final = merged["low"]
medium: Final = merged["medium"]
high: Final = merged["high"]
if not (0 < low < medium < high < 1):
raise ValueError(
f"LAR-1 thresholds must satisfy 0 < low < medium < high < 1, got low={low}, medium={medium}, high={high}"
)
return merged
def _parse_lar1_metadata(request_kwargs: dict) -> LAR1Metadata:
lar1_raw: Final = request_kwargs.get("metadata", {}).get("lar1", {})
if not isinstance(lar1_raw, dict):
verbose_router_logger.warning("[LAR-1] Invalid lar1 metadata type: %s. Using defaults", type(lar1_raw).__name__)
return LAR1Metadata()
try:
return LAR1Metadata.model_validate(lar1_raw)
except ValidationError as exc:
verbose_router_logger.warning("[LAR-1] Invalid lar1 metadata: %s. Using defaults", exc)
return LAR1Metadata()
class LAR1RoutingStrategy(CustomRoutingStrategyBase):View on GitHub (pinned to 77b7c6c40c)
Solutions
- Adjust LAR-1 thresholds so 0 < low < medium < high < 1.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/router_strategy/lar1_routing.py:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8c2c9c12295c5202.
Report an issue: GitHub.