BerriAI/litellm · error · ValueError

ARIZE_API_KEY not found in environment variables

Error message

ARIZE_API_KEY not found in environment variables

What it means

When the "arize" logging integration is initialized, LiteLLM checks that ARIZE_API_KEY exists in os.environ and raises this ValueError at setup time if it is absent. Presence is validated, not the value's correctness - the point is to fail fast instead of letting the Arize OpenTelemetry exporter silently no-op.

Solutions

  1. Export ARIZE_API_KEY (plus ARIZE_SPACE_KEY and ARIZE_SPACE_ID for your Arize space) in the process that runs litellm
  2. For the proxy, add environment: ARIZE_API_KEY=... to docker-compose/helm values so the container has it at startup
  3. Load dotenv at the very top of the entrypoint (from dotenv import load_dotenv; load_dotenv()) before litellm reads callback settings
  4. Restart/redeploy so callback initialization re-runs with the variable present

Example fix

# before
import litellm
litellm.success_callback = ["arize"]  # ValueError: ARIZE_API_KEY not found

# after
import os
os.environ["ARIZE_API_KEY"] = "..."
os.environ["ARIZE_SPACE_KEY"] = "..."
os.environ["ARIZE_SPACE_ID"] = "..."
import litellm
litellm.success_callback = ["arize"]
Defensive patterns

Strategy: validation

Validate before calling

import os

missing = [k for k in ("ARIZE_API_KEY", "ARIZE_SPACE_KEY", "ARIZE_SPACE_ID") if not os.environ.get(k)]
if missing:
    raise SystemExit(f"Missing env vars for arize: {missing}")
litellm.success_callback = ["arize"]

Prevention

When it happens

Trigger: Setting litellm.success_callback = ["arize"] (or litellm.callbacks / proxy litelly callbacks list containing "arize") in a process whose environment does not define ARIZE_API_KEY.

Common situations: .env file not loaded before litellm config in the entrypoint; proxy container missing the environment entry in docker-compose/helm; CI jobs without the secret; confusion with ARIZE_SPACE_KEY / ARIZE_SPACE_ID (also required by Arize but not covered by this check).

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at litellm/litellm_core_utils/litellm_logging.py:4560

                    return callback
        elif logging_integration == "opik":
            for callback in _in_memory_loggers:
                if isinstance(callback, OpikLogger):
                    return callback
        elif logging_integration == "langfuse":
            for callback in _in_memory_loggers:
                if isinstance(callback, LangfusePromptManagement):
                    return callback
        elif logging_integration == "otel":
            from litellm.integrations.opentelemetry import OpenTelemetry

            for callback in _in_memory_loggers:
                # Use exact type check to avoid matching ArizePhoenixLogger (subclass)
                if type(callback) is OpenTelemetry:
                    return callback
        elif logging_integration == "arize":
            if "ARIZE_API_KEY" not in os.environ:
                raise ValueError("ARIZE_API_KEY not found in environment variables")
            for callback in _in_memory_loggers:
                if isinstance(callback, ArizeLogger) and callback.callback_name == "arize":
                    return callback
        elif logging_integration == "logfire":
            if "LOGFIRE_TOKEN" not in os.environ:
                raise ValueError("LOGFIRE_TOKEN not found in environment variables")
            from litellm.integrations.opentelemetry import OpenTelemetry

            for callback in _in_memory_loggers:
                # Use exact type check to avoid matching ArizePhoenixLogger (subclass)
                if type(callback) is OpenTelemetry:
                    return callback

        elif logging_integration == "dynamic_rate_limiter":
            from litellm.proxy.hooks.dynamic_rate_limiter import (
                _PROXY_DynamicRateLimitHandler,
            )

View on GitHub (pinned to 77b7c6c40c)