BerriAI/litellm · error · Exception

Trying to use Google Text ModerationYou must be a LiteLLM En

Error message

Trying to use Google Text ModerationYou 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

The LiteLLM proxy raises this while loading the config at startup. The callback name 'google_text_moderation' was listed in litellm_settings.callbacks, but the proxy did not verify an enterprise license, so premium_user is False. The message text is a direct string concat of 'Trying to use Google Text Moderation' and CommonProxyErrors.not_premium_user, which is why the two parts run together. The proxy stops startup when this fires.

Source

Thrown at litellm/proxy/common_utils/callback_utils.py:262

                from litellm.proxy.guardrails.guardrail_hooks.aporia_ai.aporia_ai import (
                    AporiaGuardrail,
                )

                aporia_guardrail_object = AporiaGuardrail()
                imported_list.append(aporia_guardrail_object)
            elif isinstance(callback, str) and callback == "google_text_moderation":
                try:
                    from enterprise.enterprise_hooks.google_text_moderation import (
                        _ENTERPRISE_GoogleTextModeration,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Google Text Moderation,"
                        + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use Google Text Moderation" + CommonProxyErrors.not_premium_user.value)

                google_text_moderation_obj = _ENTERPRISE_GoogleTextModeration()
                imported_list.append(google_text_moderation_obj)
            elif isinstance(callback, str) and callback == "llmguard_moderations":
                try:
                    from litellm_enterprise.enterprise_callbacks.llm_guard import (
                        _ENTERPRISE_LLMGuard,
                    )
                except ImportError:
                    raise Exception("Trying to use Llm Guard" + CommonProxyErrors.missing_enterprise_package.value)

                if premium_user is not True:
                    raise Exception("Trying to use Llm Guard" + CommonProxyErrors.not_premium_user.value)

                llm_guard_moderation_obj = _ENTERPRISE_LLMGuard()
                imported_list.append(llm_guard_moderation_obj)
            elif isinstance(callback, str) and callback == "blocked_user_check":
                try:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Remove 'google_text_moderation' from litellm_settings.callbacks in the proxy config, or replace it with an open-source moderation option such as the open-source guardrails callbacks.
  2. Get a license or 7-day trial key at https://www.litellm.ai/enterprise#trial, set LITELLM_LICENSE in the proxy process env, and restart the proxy.
  3. If a license should be active, confirm it reaches the process: print os.environ.get('LITELLM_LICENSE') inside the proxy env (name only, never the value) and check startup logs for license verification failure.

Example fix

# config.yaml — before
litellm_settings:
  callbacks: ["google_text_moderation"]

# config.yaml — after (no enterprise license)
litellm_settings:
  callbacks: []

# or, with a license:
export LITELLM_LICENSE="sk-..."
# config.yaml stays as before
Defensive patterns

Strategy: validation

Validate before calling

ENTERPRISE_CALLBACKS = {"google_text_moderation", "llmguard_moderations", "blocked_user_check", "banned_keywords"}
import os

def config_will_load(cfg: dict) -> list[str]:
    problems = []
    callbacks = (cfg.get("litellm_settings") or {}).get("callbacks") or []
    used = {c for c in callbacks if isinstance(c, str)} & ENTERPRISE_CALLBACKS
    if used and not os.environ.get("LITELLM_LICENSE"):
        problems.append(f"enterprise callbacks {sorted(used)} need LITELLM_LICENSE")
    return problems

problems = config_will_load(yaml.safe_load(open("config.yaml")))
assert not problems, problems

Type guard

def is_premium_callback(callback_name: str) -> bool:
    return callback_name in {
        "google_text_moderation", "llmguard_moderations",
        "blocked_user_check", "banned_keywords",
    }

Try / catch

try:
    run_proxy(config)  # config load that raises on gated callbacks
except Exception as e:
    if "must be a LiteLLM Enterprise user" in str(e):
        fix_license_or_callbacks(e)  # set LITELLM_LICENSE or strip the callback
    else:
        raise

Prevention

When it happens

Trigger: Start litellm proxy with a config.yaml that contains litellm_settings: callbacks: ['google_text_moderation'] while the LITELLM_LICENSE env var is unset, empty, invalid, or expired. premium_user is decided once at proxy startup from LITELLM_LICENSE, so any later env change needs a restart.

Common situations: Copying a guardrail example config from the LiteLLM docs that includes enterprise callbacks. A trial key expired. LITELLM_LICENSE was added to a .env file that the Docker container or systemd unit does not load.

Related errors


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