BerriAI/litellm · error · ValueError

LEVOAI_COLLECTOR_URL environment variable is required for Le

Error message

LEVOAI_COLLECTOR_URL environment variable is required for Levo integration. Please contact Levo support to get your collector URL.

What it means

Levo integration validation: LEVOAI_COLLECTOR_URL is missing. This URL is the OTLP HTTP endpoint events are POSTed to and is customer-specific (one per Levo tenant), which is why the message tells you to contact Levo support. Without it, no endpoint exists and exporter construction fails.

Source

Thrown at litellm/integrations/levo/levo.py:65

        Raises:
            ValueError: If required environment variables are missing.
        """
        # Required environment variables
        api_key: Final = os.environ.get("LEVOAI_API_KEY", None)
        org_id: Final = os.environ.get("LEVOAI_ORG_ID", None)
        workspace_id: Final = os.environ.get("LEVOAI_WORKSPACE_ID", None)
        collector_url: Final = os.environ.get("LEVOAI_COLLECTOR_URL", None)

        # Validate required env vars
        if not api_key:
            raise ValueError("LEVOAI_API_KEY environment variable is required for Levo integration.")
        if not org_id:
            raise ValueError("LEVOAI_ORG_ID environment variable is required for Levo integration.")
        if not workspace_id:
            raise ValueError("LEVOAI_WORKSPACE_ID environment variable is required for Levo integration.")
        if not collector_url:
            raise ValueError(
                "LEVOAI_COLLECTOR_URL environment variable is required for Levo integration. "
                "Please contact Levo support to get your collector URL."
            )

        # Use collector URL exactly as provided by the user
        endpoint: Final = collector_url
        protocol: Final[Protocol] = "otlp_http"

        # Build OTLP headers string
        # Format: Authorization=Bearer {api_key},x-levo-organization-id={org_id},x-levo-workspace-id={workspace_id}
        headers_parts: Final = [f"Authorization=Bearer {api_key}"]
        headers_parts.append(f"x-levo-organization-id={org_id}")
        headers_parts.append(f"x-levo-workspace-id={workspace_id}")

        otlp_auth_headers: Final = ",".join(headers_parts)

        return LevoConfig(
            otlp_auth_headers=otlp_auth_headers,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Obtain your collector URL from Levo support and export LEVOAI_COLLECTOR_URL=https://<your-tenant-collector>
  2. Confirm the URL matches exactly what Levo provided (it is used verbatim)
  3. Set it alongside the other three LEVOAI_* vars in the deployment env
  4. Until provisioned, disable the levo callback to keep the proxy bootable

Example fix

# before
# LEVOAI_COLLECTOR_URL unset -> ValueError ... contact Levo support

# after
export LEVOAI_API_KEY=...
export LEVOAI_ORG_ID=...
export LEVOAI_WORKSPACE_ID=...
export LEVOAI_COLLECTOR_URL=https://collect.mycompany.levo.ai
Defensive patterns

Strategy: validation

Validate before calling

import os

def levo_config_valid() -> bool:
    return bool(os.getenv("LEVOAI_COLLECTOR_URL"))

Prevention

When it happens

Trigger: levo callback enabled with the other three vars set but no LEVOAI_COLLECTOR_URL; URL present in a local .env but not loaded in the container; a placeholder value that was never replaced.

Common situations: New Levo customers who have keys/org/workspace but have not completed collector provisioning (Levo support supplies the URL); environments where only the generic Levo doc vars were set.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/6ae22d7c598c2be1. Report an issue: GitHub.