BerriAI/litellm · error · ValueError

/spend/report endpoint You must be a LiteLLM Enterprise user

Error message

/spend/report endpoint You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. 
Pricing: https://www.litellm.ai/#pricing

What it means

Error "/spend/report endpoint You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. Pricing: https://www.litellm.ai/#pricing" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:1244

        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail={"error": "Please provide start_date and end_date"},
        )

    start_date_obj: Final = datetime.strptime(start_date, "%Y-%m-%d").replace(tzinfo=timezone.utc)
    end_date_obj: Final = datetime.strptime(end_date, "%Y-%m-%d").replace(tzinfo=timezone.utc)

    from litellm.proxy.proxy_server import premium_user, prisma_client

    try:
        if prisma_client is None:
            raise Exception(
                "Database not connected. Connect a database to your proxy - https://docs.litellm.ai/docs/simple_proxy#managing-auth---virtual-keys"
            )

        if premium_user is not True:
            verbose_proxy_logger.debug("accessing /spend/report but not a premium user")
            raise ValueError("/spend/report endpoint " + CommonProxyErrors.not_premium_user.value)
        db_response: Sequence[Mapping[str, object]] | None
        if api_key is not None:
            verbose_proxy_logger.debug("Getting /spend for api_key: [set=%s]", api_key is not None)
            if api_key.startswith("sk-"):
                api_key = hash_token(token=api_key)
            sql_query = """
                WITH SpendByModelApiKey AS (
                    SELECT
                        sl.api_key,
                        sl.model,
                        SUM(sl.spend) AS model_cost,
                        SUM(sl.prompt_tokens) AS model_input_tokens,
                        SUM(sl.completion_tokens) AS model_output_tokens
                    FROM
                        "LiteLLM_SpendLogs" sl
                    WHERE
                        sl."startTime" >= ($1::timestamptz AT TIME ZONE 'UTC')
                        AND sl."startTime" <  (($2::timestamptz + INTERVAL '1 day') AT TIME ZONE 'UTC')

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set LITELLM_LICENSE to a valid Enterprise license key, or request a 7-day trial key from litellm.ai.

When it happens

Trigger: Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:1244 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/f1f4ff8b9bfa0e59. Report an issue: GitHub.