{"record":{"id":"8cf0ea5b54ff891c","repo":"BerriAI/litellm","slug":"levoai-org-id-environment-variable-is-required-for","errorCode":null,"errorMessage":"LEVOAI_ORG_ID environment variable is required for Levo integration.","messagePattern":"LEVOAI_ORG_ID environment variable is required for Levo integration\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/levo/levo.py","lineNumber":61,"sourceCode":"        Retrieves the Levo configuration based on environment variables.\n\n        Returns:\n            LevoConfig: Configuration object containing Levo OTLP settings.\n\n        Raises:\n            ValueError: If required environment variables are missing.\n        \"\"\"\n        # Required environment variables\n        api_key: Final = os.environ.get(\"LEVOAI_API_KEY\", None)\n        org_id: Final = os.environ.get(\"LEVOAI_ORG_ID\", None)\n        workspace_id: Final = os.environ.get(\"LEVOAI_WORKSPACE_ID\", None)\n        collector_url: Final = os.environ.get(\"LEVOAI_COLLECTOR_URL\", None)\n\n        # Validate required env vars\n        if not api_key:\n            raise ValueError(\"LEVOAI_API_KEY environment variable is required for Levo integration.\")\n        if not org_id:\n            raise ValueError(\"LEVOAI_ORG_ID environment variable is required for Levo integration.\")\n        if not workspace_id:\n            raise ValueError(\"LEVOAI_WORKSPACE_ID environment variable is required for Levo integration.\")\n        if not collector_url:\n            raise ValueError(\n                \"LEVOAI_COLLECTOR_URL environment variable is required for Levo integration. \"\n                \"Please contact Levo support to get your collector URL.\"\n            )\n\n        # Use collector URL exactly as provided by the user\n        endpoint: Final = collector_url\n        protocol: Final[Protocol] = \"otlp_http\"\n\n        # Build OTLP headers string\n        # Format: Authorization=Bearer {api_key},x-levo-organization-id={org_id},x-levo-workspace-id={workspace_id}\n        headers_parts: Final = [f\"Authorization=Bearer {api_key}\"]\n        headers_parts.append(f\"x-levo-organization-id={org_id}\")\n        headers_parts.append(f\"x-levo-workspace-id={workspace_id}\")\n","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/levo/levo.py#L43-L79","documentation":"Levo integration validation: LEVOAI_ORG_ID is missing. The org id becomes the x-levo-organization-id OTLP header, so without it the collector cannot attribute events and the exporter config build aborts with ValueError.","triggerScenarios":"Enabling the levo callback without LEVOAI_ORG_ID exported; copying Levo's onboarding snippet that lists the key/URL but skips the org id; org id set as an empty string.","commonSituations":"Levo onboarding where the customer receives collector URL and API key immediately but must look up org/workspace ids in the Levo console; misordered secret injection in deploy pipelines.","solutions":["export LEVOAI_ORG_ID=<org id from Levo console>","Confirm all four LEVOAI_* vars are present in the same environment ('env | grep LEVOAI')","Add the var to your secret manager / K8s secret so restarts keep it","Disable the levo callback if unused"],"exampleFix":"# before\n# only LEVOAI_API_KEY, LEVOAI_WORKSPACE_ID, LEVOAI_COLLECTOR_URL set\n# ValueError: LEVOAI_ORG_ID environment variable is required\n\n# after\nexport LEVOAI_API_KEY=...\nexport LEVOAI_ORG_ID=my-org\nexport LEVOAI_WORKSPACE_ID=...\nexport LEVOAI_COLLECTOR_URL=https://...","handlingStrategy":"validation","validationCode":"import os\n\ndef levo_config_valid() -> bool:\n    return bool(os.getenv(\"LEVOAI_ORG_ID\"))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a startup checklist helper that validates every LEVOAI_* key","Copy org/workspace ids from the Levo console during onboarding, not by hand"],"tags":["python","levo","environment","configuration"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}