BerriAI/litellm · error · ValueError
CloudZero configuration missing. Please set CLOUDZERO_API_KE
Error message
CloudZero configuration missing. Please set CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables.
What it means
ValueError from CloudZeroLogger's usage-export routine when either CLOUDZERO_API_KEY or CLOUDZERO_CONNECTION_ID is empty/None at export time. The check runs inside the export job after imports, so the logger constructs fine but the export fails — typically in a background task or scheduled job. Both values come from the logger's initialization settings/env.
Source
Thrown at litellm/integrations/cloudzero/cloudzero.py:120
- Reads data from the DB
- Transforms the data to the CloudZero format
- Sends the data to CloudZero
Args:
limit: Optional limit on number of records to export
operation: CloudZero operation type ("replace_hourly" or "sum")
"""
from litellm.integrations.cloudzero.cz_stream_api import CloudZeroStreamer
from litellm.integrations.cloudzero.database import LiteLLMDatabase
from litellm.integrations.cloudzero.transform import CBFTransformer
try:
verbose_logger.debug("CloudZero Logger: Starting usage data export")
# Validate required configuration
if not self.api_key or not self.connection_id:
raise ValueError(
"CloudZero configuration missing. Please set CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables."
)
# Initialize database connection and load data
database: Final = LiteLLMDatabase()
verbose_logger.debug("CloudZero Logger: Loading usage data from database")
data = await database.get_usage_data(limit=limit, start_time_utc=start_time_utc, end_time_utc=end_time_utc)
if data.is_empty():
verbose_logger.debug("CloudZero Logger: No usage data found to export")
return
verbose_logger.debug("CloudZero Logger: Processing %s records", len(data))
# Transform data to CloudZero CBF format
transformer: Final = CBFTransformer()
cbf_data: Final = transformer.transform(data)
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set both CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables for the proxy process
- Get the connection ID from the CloudZero dashboard (Streamer connection settings) — it is a UUID, not the connection name
- Verify both are visible to the process: printenv | grep CLOUDZERO
- If CloudZero export is not wanted, remove/disable the scheduled export so the config check never fires
Example fix
# before
# proxy config enables cloudzero logger without credentials
environment_variables: {}
# after
environment_variables:
CLOUDZERO_API_KEY: os.environ/CLOUDZERO_API_KEY
CLOUDZERO_CONNECTION_ID: os.environ/CLOUDZERO_CONNECTION_ID Defensive patterns
Strategy: validation
Validate before calling
import os
def cloudzero_config_ready() -> tuple[bool, list[str]]:
missing = [k for k in ("CLOUDZERO_API_KEY", "CLOUDZERO_CONNECTION_ID") if not os.getenv(k)]
return (not missing, missing)
ok, missing = cloudzero_config_ready()
if not ok:
raise RuntimeError(f"CloudZero export disabled: missing {missing}") Try / catch
try:
await cloudzero_logger.export_usage_data(...)
except ValueError as e:
if "configuration missing" in str(e):
logger.error("CloudZero credentials absent; skipping export cycle")
else:
raise Prevention
- Check both env vars in a startup config validation step
- Copy the connection ID (UUID) from CloudZero exactly — not the name
- Add config schema validation so misspelled keys fail loudly
When it happens
Trigger: Configuring the cloudzero callback without providing both required settings, providing the API key via a differently-named env var, or a config file where cloudzero settings keys are misspelled so they default to None.
Common situations: Onboarding CloudZero cost analytics: connection created in the CloudZero dashboard but its ID never copied into proxy config; secrets mounted but env var names differ from expected; staging config promoted to prod without the cloudzero credentials block.
Related errors
- AZURE_SENTINEL_DCR_IMMUTABLE_ID is required. Set it as an en
- AZURE_SENTINEL_ENDPOINT is required. Set it as an environmen
- AZURE_SENTINEL_TENANT_ID or AZURE_TENANT_ID is required. Set
- AZURE_SENTINEL_CLIENT_ID or AZURE_CLIENT_ID is required. Set
- AZURE_SENTINEL_CLIENT_SECRET or AZURE_CLIENT_SECRET is requi
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/19a0cd1129ef7b6a.
Report an issue: GitHub.