BerriAI/litellm · error · HTTPException

Model '{m}' not in team's allowed models. Team allowed model

Error message

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

What it means

A project inherits model access from its parent team; the project's models list must be a subset of the team's allowed models. If any requested model is not in the team's model list, LiteLLM rejects the request with HTTP 400 listing the offending model and the team's allowed set. Teams whose models include SpecialModelNames.all_proxy_models ('all-proxy-models') bypass this check entirely.

Source

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

    # --- 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 = 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 6c2dcb801b)

Solutions

  1. Add the missing model to the parent team first (PUT /team/update), then retry the project request
  2. Remove the offending model from the project's models list
  3. Set the team's models to ["all-proxy-models"] if the team should allow every proxy model
  4. Verify exact model names/aliases via GET /team/info before submitting

Example fix

// before
team.models = ["gpt-4o"]
project.models = ["gpt-4o", "claude-3-5-sonnet"]
// after
team.models = ["gpt-4o", "claude-3-5-sonnet"]
project.models = ["gpt-4o", "claude-3-5-sonnet"]
Defensive patterns

Strategy: validation

Validate before calling

team = await client.get(f'/team/info?team_id={team_id}')
allowed = team.teams[0].models or []
if 'all-proxy-models' not in allowed:
    bad = [m for m in (payload.get('models') or []) if m not in allowed]
    if bad:
        raise ValueError(f'models not allowed by team: {bad}; allowed: {allowed}')

Type guard

const modelsAreSubset = (projectModels, teamModels) =>
  teamModels.includes('all-proxy-models') ||
  projectModels.every((m) => teamModels.includes(m));

Try / catch

catch (e) {
  if (e.status === 400 && /not in team's allowed models/.test(e.body?.detail?.error ?? '')) {
    payload.models = payload.models.filter((m) => teamModels.includes(m)); return retry(payload);
  }
  throw e;
}

Prevention

When it happens

Trigger: POST /project/new or PUT /project/update with a "models" array containing a model absent from the team's models, e.g. team allows ["gpt-4o"] and the project requests ["gpt-4o", "claude-3-5-sonnet"]. Only fires when both the project supplies models and the team has a non-empty models list that is not 'all-proxy-models'.

Common situations: Adding a newly deployed model to a project before adding it to the team, model naming mismatches (alias vs deployment name), or moving a project to a more restrictive team.

Related errors


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