BerriAI/litellm · error · HTTPException

max_budget ({_requested_max_budget}) cannot exceed the calle

Error message

max_budget ({_requested_max_budget}) cannot exceed the caller's own max_budget ({delegation_ceiling}).

What it means

LiteLLM Proxy enforces a delegation ceiling: a non-admin caller (or a session token not targeting its own UI team) cannot give a new key a max_budget larger than the caller's own effective max_budget — their key's max_budget, or for session tokens the owning team's max_budget. This stops users from escalating spend authority they were never granted.

Source

Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:957

                "error": (
                    f"max_budget ({_requested_max_budget}) cannot be set without "
                    "specifying team_id when using a CLI session token."
                )
            },
        )
    delegation_ceiling: Final = (
        user_api_key_dict.max_budget
        if user_api_key_dict.max_budget is not None
        else (team_table.max_budget if user_api_key_dict.is_session_token and team_table is not None else None)
    )
    if (
        user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value
        and not is_ui_session_team_key
        and _requested_max_budget is not None
        and delegation_ceiling is not None
        and _requested_max_budget > delegation_ceiling
    ):
        raise HTTPException(
            status_code=400,
            detail={
                "error": (
                    f"max_budget ({_requested_max_budget}) cannot exceed the caller's "
                    f"own max_budget ({delegation_ceiling})."
                )
            },
        )

    _check_budget_limits_delegation_ceiling(
        budget_limits=data.budget_limits,
        delegation_ceiling=delegation_ceiling,
        user_api_key_dict=user_api_key_dict,
        is_ui_session_team_key=is_ui_session_team_key,
        team_table=team_table,
    )
    _check_permissions_caller_permission(
        data=data,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set the new key's max_budget to a value <= the caller's own max_budget (or the team's, for session tokens)
  2. Ask a proxy admin to first raise the caller's key budget (or team max_budget), then retry
  3. If the caller should genuinely have this authority, have a proxy admin create the key directly

Example fix

# before: caller's own key has max_budget=50
requests.post(f"{PROXY}/key/generate", headers=AUTH, json={"max_budget": 100})

# after
requests.post(f"{PROXY}/key/generate", headers=AUTH, json={"max_budget": 50})
Defensive patterns

Strategy: validation

Validate before calling

# Fetch the caller's own key info and clamp the delegated budget
me = requests.get(f"{PROXY}/key/info", headers=AUTH, params={"key": CALLER_KEY}).json()
ceiling = me["key_info"]["max_budget"]
if ceiling is not None:
    payload["max_budget"] = min(payload["max_budget"], ceiling)

Try / catch

try:
    resp = requests.post(f"{PROXY}/key/generate", headers=AUTH, json=payload)
except requests.HTTPError as e:
    if e.response.status_code == 400 and "cannot exceed the caller's own max_budget" in e.response.text:
        payload["max_budget"] = ceiling  # retry at the ceiling value
        resp = requests.post(f"{PROXY}/key/generate", headers=AUTH, json=payload)
    else:
        raise

Prevention

When it happens

Trigger: POST /key/generate or /key/update where the caller is not a proxy admin, the body's "max_budget" is a number, delegation_ceiling is not None, and _requested_max_budget > delegation_ceiling (e.g. a key capped at $50 tries to mint a $100 key).

Common situations: Self-service tooling lets users pick arbitrary budgets; an admin lowered a user's/key's budget after the script was written; a session token whose team budget is smaller than the requested key budget.

Related errors


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