BerriAI/litellm · error · HTTPException

Model ' ' not in team's allowed models. Team allowed…

Error message

Model '{m}' not in team's allowed models. Team allowed models={team_models}. Team: {team_object.team_id}

What it means

Project models must be a subset of the parent team's models: _check_team_project_limits iterates data.models and rejects any model not in team_object.models with HTTP 400 naming the offending model and the allowed list. Validation is skipped only when the team's list contains 'all-proxy-models'.

Solutions

  1. Remove the offending model from the project's models list
  2. Add the model to the team first via POST /team/update, then retry
  3. Or set the team's models to ["all-proxy-models"] to delegate allowlisting to projects

Example fix

# before
team models: ["gpt-4o"]
project payload: {"models": ["claude-3-sonnet"]}

# after
team models: ["gpt-4o", "claude-3-sonnet"]
project payload: {"models": ["claude-3-sonnet"]}
Defensive patterns

Strategy: validation

Validate before calling

team = await get(f"/team/info?team_id={data['team_id']}")
team_models = set(team["team_info"]["models"] or [])
if "all-proxy-models" not in team_models:
    bad = set(data.get("models") or []) - team_models
    if bad:
        raise ValueError(f"models {bad} not allowed for team; add them to the team first")

Try / catch

try:
    await post("/project/new", json=data)
except HTTPStatusError as e:
    if e.response.status_code == 400 and "not in team's allowed models" in e.response.text:
        await add_models_to_team(data["team_id"], data["models"])
        retry()
    raise

Prevention

When it happens

Trigger: POST /project/new with models: ["claude-3-sonnet"] while the referenced team's models are e.g. ["gpt-4o"].

Common situations: New model rolled out at project level before being added to the team; project payloads copied across teams with different allowlists; team model lists edited after projects were templated.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/3354053b9c7049ff. Report an issue: GitHub.

Appendix: source

Thrown at enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py:171

    # --- soft_budget < max_budget ---
    if data.soft_budget is not None and data.max_budget is not None:
        if data.soft_budget >= data.max_budget:
            raise HTTPException(
                status_code=400,
                detail={
                    "error": f"soft_budget ({data.soft_budget}) must be strictly lower than max_budget ({data.max_budget})"
                },
            )

    # --- Validate project models are a subset of team models ---
    project_models = data.models
    team_models: list[str] = team_object.models or []
    if project_models and len(team_models) > 0:
        # If team has 'all-proxy-models', skip validation as it allows all models
        if SpecialModelNames.all_proxy_models.value not in team_models:
            for m in project_models:
                if m not in team_models:
                    raise HTTPException(
                        status_code=400,
                        detail={
                            "error": f"Model '{m}' not in team's allowed models. Team allowed models={team_models}. Team: {team_object.team_id}"
                        },
                    )

    # --- Validate project max_budget <= team max_budget ---
    # Team stores budget fields directly (max_budget, tpm_limit, rpm_limit)
    # unlike Project which uses a separate LiteLLM_BudgetTable relation
    if data.max_budget is not None and team_object.max_budget is not None and data.max_budget > team_object.max_budget:
        raise HTTPException(
            status_code=400,
            detail={
                "error": f"Project max_budget ({data.max_budget}) exceeds team's max_budget ({team_object.max_budget}). Team: {team_object.team_id}"
            },
        )

    # --- Validate project tpm_limit <= team tpm_limit ---

View on GitHub (pinned to 77b7c6c40c)