BerriAI/litellm · error · ValueError

Set either 'max_budget' or 'budget_id', not both.

Error message

Set either 'max_budget' or 'budget_id', not both.

What it means

Pydantic validator on the new-customer request rejecting a payload that sets both budget_id and max_budget. These are the two mutually exclusive ways to allocate spend budget to an end customer — reference an existing budget or create one inline from a number — and supplying both makes the intended allocation ambiguous, so the create is refused.

Source

Thrown at litellm/proxy/_types.py:1788

    Create a new customer, allocate a budget to them
    """

    user_id: str
    alias: str | None = None  # human-friendly alias
    blocked: bool = False  # allow/disallow requests for this end-user
    budget_id: str | None = None  # give either a budget_id or max_budget
    spend: float | None = None
    allowed_model_region: AllowedModelRegion | None = (
        None  # require all user requests to use models in this specific region
    )
    default_model: str | None = None  # if no equivalent model in allowed region - default all requests to this model
    object_permission: LiteLLM_ObjectPermissionBase | None = None

    @model_validator(mode="before")
    @classmethod
    def check_user_info(cls, values):
        if values.get("max_budget") is not None and values.get("budget_id") is not None:
            raise ValueError("Set either 'max_budget' or 'budget_id', not both.")

        return values


class UpdateCustomerRequest(LiteLLMPydanticObjectBase):
    """
    Update a Customer, use this to update customer budgets etc

    """

    user_id: str
    alias: str | None = None  # human-friendly alias
    blocked: bool = False  # allow/disallow requests for this end-user
    max_budget: float | None = None
    budget_id: str | None = None  # give either a budget_id or max_budget
    allowed_model_region: AllowedModelRegion | None = (
        None  # require all user requests to use models in this specific region
    )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set only one of max_budget or budget_id.

Example fix

budget_id='budget-1'  # and omit max_budget
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_types.py:1788 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/4e57ca98ddcc939e. Report an issue: GitHub.