BerriAI/litellm · error · HTTPException

Project max_budget ({data.max_budget}) exceeds team's max_bu

Error message

Project max_budget ({data.max_budget}) exceeds team's max_budget ({team_object.max_budget}). Team: {team_object.team_id}

What it means

LiteLLM's hierarchical budget model requires a project's max_budget to not exceed its parent team's max_budget, so spending cannot bypass the team-level cap. If both the project request and the team row define max_budget and the project's value is larger, HTTP 400 is returned. The team stores budgets directly on LiteLLM_TeamTable (unlike projects, which use a separate LiteLLM_BudgetTable row).

Source

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

    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 ---
    if data.tpm_limit is not None and team_object.tpm_limit is not None and data.tpm_limit > team_object.tpm_limit:
        raise HTTPException(
            status_code=400,
            detail={
                "error": f"Project tpm_limit ({data.tpm_limit}) exceeds team's tpm_limit ({team_object.tpm_limit}). Team: {team_object.team_id}"
            },
        )

    # --- Validate project rpm_limit <= team rpm_limit ---
    if data.rpm_limit is not None and team_object.rpm_limit is not None and data.rpm_limit > team_object.rpm_limit:
        raise HTTPException(

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Lower the project's max_budget to at most the team's max_budget
  2. Raise the team's max_budget first (PUT /team/update), then create/update the project
  3. Omit max_budget on the project request if it should not have its own cap

Example fix

// before
team.max_budget = 100
project payload: {"max_budget": 500}
// after
team.max_budget = 1000
project payload: {"max_budget": 500}
Defensive patterns

Strategy: validation

Validate before calling

team = await client.get(f'/team/info?team_id={payload["team_id"]}')
team_max = team.teams[0].max_budget
if payload.get('max_budget') is not None and team_max is not None:
    if payload['max_budget'] > team_max:
        raise ValueError(f'project max_budget exceeds team cap {team_max}; raise the team budget first')

Type guard

const withinTeamBudget = (p, team) =>
  p.max_budget == null || team.max_budget == null || p.max_budget <= team.max_budget;

Prevention

When it happens

Trigger: POST /project/new or PUT /project/update where data.max_budget > team_object.max_budget and both are non-null, e.g. team max_budget=100 and project max_budget=500. A None on either side skips the check.

Common situations: Creating a project budget larger than the team's without first raising the team cap, or reassigning a project to a team with a smaller budget via PUT /project/update with a new team_id.

Related errors


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