BerriAI/litellm · error · ValueError

quality_tier= is not supported; valid tiers are

Error message

quality_tier={prefs.quality_tier} is not supported; valid tiers are {valid}

What it means

Config validation in the adaptive-router bandit priors: the requested quality_tier in AdaptiveRouterPreferences is not one of the valid tier values (listed in the message), so no base prior weight exists for it.

Solutions

  1. Use one of the listed valid quality tiers in routing preferences.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/router_strategy/adaptive_router/bandit.py:55 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/8522695bc8b08f3a. Report an issue: GitHub.

Appendix: source

Thrown at litellm/router_strategy/adaptive_router/bandit.py:55

        total: Final = self.alpha + self.beta
        return self.alpha / total if total > 0 else 0.5

    @property
    def total_samples(self) -> int:
        return max(0, int(self.alpha + self.beta - COLD_START_MASS))


def initial_cell(prefs: AdaptiveRouterPreferences, request_type: RequestType) -> BanditCell:
    """
    Cold-start prior for a (model, request_type) cell.

    mean = base_tier_weight[tier] + (STRENGTH_BONUS if request_type in strengths else 0)
    capped at 0.95 to avoid an over-confident prior.
    Total mass = COLD_START_MASS so that ~10 real observations can move it noticeably.
    """
    if prefs.quality_tier not in BASE_TIER_WEIGHT:
        valid: Final = sorted(BASE_TIER_WEIGHT)
        raise ValueError(f"quality_tier={prefs.quality_tier} is not supported; valid tiers are {valid}")
    base: Final = BASE_TIER_WEIGHT[prefs.quality_tier]
    bonus: Final = STRENGTH_BONUS if request_type in prefs.strengths else 0.0
    mean: Final = min(0.95, base + bonus)
    alpha: Final = mean * COLD_START_MASS
    beta: Final = (1.0 - mean) * COLD_START_MASS
    return BanditCell(alpha=alpha, beta=beta)


def apply_delta(cell: BanditCell, delta_alpha: float, delta_beta: float) -> BanditCell:
    """
    Apply a learning update to a cell, enforcing the sample cap.

    SAMPLE_CAP is a HARD cap on (alpha + beta). When the cap would be exceeded,
    we drop the update. (D5: hard cap, no rescaling — keep v0 simple.)
    """
    new_alpha: Final = cell.alpha + delta_alpha
    new_beta: Final = cell.beta + delta_beta
    if new_alpha + new_beta > SAMPLE_CAP:

View on GitHub (pinned to 77b7c6c40c)