BerriAI/litellm · error · ValueError
LEVOAI_API_KEY environment variable is required for Levo…
Error message
LEVOAI_API_KEY environment variable is required for Levo integration.
What it means
Configuration guard for the Levo OTLP integration: the LEVOAI_API_KEY environment variable is not set, so the tracer cannot authenticate to the Levo collector and the config getter raises.
Solutions
- Set the LEVOAI_API_KEY environment variable with your Levo API key.
Example fix
export LEVOAI_API_KEY=...
Defensive patterns
Strategy: validation
When it happens
Trigger: Initializing the Levo integration while LEVOAI_API_KEY is unset.
Common situations: Env var not exported in the deployment or .env file not loaded.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7a789772bfb0751c.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/levo/levo.py:59
def get_levo_config() -> LevoConfig:
"""
Retrieves the Levo configuration based on environment variables.
Returns:
LevoConfig: Configuration object containing Levo OTLP settings.
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}")View on GitHub (pinned to 77b7c6c40c)