{"record":{"id":"ba6a953060eb19f8","repo":"BerriAI/litellm","slug":"phoenix-api-key-must-be-set-when-using-phoenix-clo","errorCode":null,"errorMessage":"PHOENIX_API_KEY must be set when using Phoenix Cloud (app.phoenix.arize.com).","messagePattern":"PHOENIX_API_KEY must be set when using Phoenix Cloud \\(app\\.phoenix\\.arize\\.com\\)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/arize/arize_phoenix.py","lineNumber":436,"sourceCode":"                        endpoint = f\"{collector_endpoint}v1/traces\"\n                    else:\n                        endpoint = f\"{collector_endpoint}/v1/traces\"\n                else:\n                    endpoint = collector_endpoint\n                protocol = \"otlp_http\"\n        else:\n            endpoint = \"http://localhost:6006/v1/traces\"\n            protocol = \"otlp_http\"\n            verbose_logger.debug(\n                \"No PHOENIX_COLLECTOR_ENDPOINT found, using default local Phoenix endpoint: %s\", endpoint\n            )\n\n        otlp_auth_headers = None\n        if api_key is not None:\n            auth_header_key = \"authorization\" if protocol == \"otlp_grpc\" else \"Authorization\"\n            otlp_auth_headers = f\"{auth_header_key}=Bearer {api_key}\"\n        elif \"app.phoenix.arize.com\" in endpoint:\n            raise ValueError(\"PHOENIX_API_KEY must be set when using Phoenix Cloud (app.phoenix.arize.com).\")\n\n        project_name: Final = os.environ.get(\"PHOENIX_PROJECT_NAME\") or \"default\"\n\n        return ArizePhoenixConfig(\n            otlp_auth_headers=otlp_auth_headers,\n            protocol=protocol,\n            endpoint=endpoint,\n            project_name=project_name,\n        )\n\n    async def async_health_check(self):\n        config: Final = self.get_arize_phoenix_config()\n\n        if not config.otlp_auth_headers:\n            return {\n                \"status\": \"unhealthy\",\n                \"error_message\": \"PHOENIX_API_KEY environment variable not set\",\n            }","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/arize/arize_phoenix.py#L418-L454","documentation":"When the Arize Phoenix tracer sends OTLP spans to a Phoenix Cloud endpoint (host contains 'app.phoenix.arize.com'), authentication is mandatory. In `get_arize_phoenix_config`, if no api_key was supplied and the resolved endpoint is Phoenix Cloud, litellm raises this ValueError instead of silently sending unauthenticated spans that would be rejected.","triggerScenarios":"Enabling the Arize Phoenix callback (`litellm.callbacks = [\"arize_phoenix\"]`) with PHOENIX_COLLECTOR_ENDPOINT pointing at app.phoenix.arize.com (or its OTLP/gRPC variants) but no api_key argument and no PHOENIX_API_KEY env var.","commonSituations":"Migrating from a local Phoenix (http://localhost:6006/v1/traces, where auth is skipped) to Phoenix Cloud without adding the key; setting the collector endpoint via PHOENIX_COLLECTOR_ENDPOINT in one place and the key in another that never reaches the process; proxy deployments where the env var is missing from the container.","solutions":["Set PHOENIX_API_KEY in the process environment before enabling the callback: `export PHOENIX_API_KEY=your_phoenix_api_key`","Or pass the key explicitly when configuring the callback (api_key argument / `PHOENIX_API_KEY` in the proxy env)","If you did not intend to use Phoenix Cloud, point PHOENIX_COLLECTOR_ENDPOINT back at your local/collector endpoint so the Cloud check does not fire"],"exampleFix":"# before\nos.environ[\"PHOENIX_COLLECTOR_ENDPOINT\"] = \"https://app.phoenix.arize.com/v1/traces\"\nlitellm.callbacks = [\"arize_phoenix\"]  # ValueError: PHOENIX_API_KEY must be set\n\n# after\nos.environ[\"PHOENIX_API_KEY\"] = \"phoenix-key-123\"\nos.environ[\"PHOENIX_COLLECTOR_ENDPOINT\"] = \"https://app.phoenix.arize.com/v1/traces\"\nlitellm.callbacks = [\"arize_phoenix\"]","handlingStrategy":"validation","validationCode":"import os\n\nendpoint = os.getenv(\"PHOENIX_COLLECTOR_ENDPOINT\", \"\")\nif \"app.phoenix.arize.com\" in endpoint and not os.getenv(\"PHOENIX_API_KEY\"):\n    raise SystemExit(\"Phoenix Cloud endpoint requires PHOENIX_API_KEY\")\nlitellm.callbacks = [\"arize_phoenix\"]","typeGuard":"def phoenix_cloud_needs_key(endpoint: str, api_key: str | None) -> bool:\n    return \"app.phoenix.arize.com\" in endpoint and not api_key","tryCatchPattern":"try:\n    litellm.callbacks = [\"arize_phoenix\"]\nexcept ValueError as e:\n    if \"PHOENIX_API_KEY\" in str(e):\n        # skip tracing for Cloud until key is provisioned; keep serving\n        litellm.callbacks = [c for c in (litellm.callbacks or []) if c != \"arize_phoenix\"]\n        log.warning(\"Phoenix tracing disabled: %s\", e)\n    else:\n        raise","preventionTips":["Pair PHOENIX_COLLECTOR_ENDPOINT and PHOENIX_API_KEY in the same secret set; one without the other will fail on Cloud","Add a startup assertion that any Cloud endpoint implies a non-empty key"],"tags":["arize-phoenix","tracing","authentication","environment-variable","otlp"],"backgroundTag":"missing-api-key","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}