BerriAI/litellm · error · ValueError

Regenerating Virtual Keys is an Enterprise feature, {CommonP

Error message

Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}

What it means

Error "Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}" thrown in BerriAI/litellm.

Source

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

                allow_safe_presets=True,
            )

        # Premium-gate bypass for master-key rotation must verify the
        # caller actually holds the master key, not just that the request
        # body has a ``new_master_key`` field. A presence-only check let
        # any non-premium caller skip the enterprise gate by sending any
        # value in that field.
        regenerate_target_key: Final = data.key if data and data.key else key
        is_master_key_regeneration: Final = (
            data is not None
            and data.new_master_key is not None
            and _is_master_key(api_key=regenerate_target_key, _master_key=master_key)
        )

        if (
            premium_user is not True and not is_master_key_regeneration
        ):  # allow master key regeneration for non-premium users
            raise ValueError(
                f"Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}"
            )

        # Check if key exists, raise exception if key is not in the DB
        key = data.key if data and data.key else key
        if not key:
            raise HTTPException(status_code=400, detail={"error": "No key passed in."})
        ### 1. Create New copy that is duplicate of existing key
        ######################################################################

        # create duplicate of existing key
        # set token = new token generated
        # insert new token in DB

        # create hash of token
        if prisma_client is None:
            raise HTTPException(
                status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set LITELLM_LICENSE in the proxy environment with a valid enterprise license.
  2. Create a new key instead of regenerating if enterprise features are unavailable.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4922 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/9bd39c7ab55954e8. Report an issue: GitHub.