BerriAI/litellm · error · ValueError

endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOI

Error message

endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables

What it means

GenericAPILogger raises ValueError when no endpoint can be resolved: the constructor takes an optional endpoint param, falls back to the GENERIC_LOGGER_ENDPOINT env var, and if both are absent it cannot send logs anywhere. Note that when a callback_name matches an entry in generic_api_compatible_callbacks.json, endpoint may come from that file; the raise covers the case where none of these sources produced a URL.

Source

Thrown at litellm/integrations/generic_api/generic_api_callback.py:157

                                headers[key] = substitute_env_variables(value)

                    if event_types is None and "event_types" in callback_config:
                        event_types = callback_config["event_types"]

                    if log_format is None and "log_format" in callback_config:
                        log_format = callback_config["log_format"]
            else:
                verbose_logger.warning(
                    "callback_name '%s' not found in generic_api_compatible_callbacks.json", callback_name
                )

        #########################################################
        # Init httpx client
        #########################################################
        self.async_httpx_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)
        endpoint = endpoint or os.getenv("GENERIC_LOGGER_ENDPOINT")
        if endpoint is None:
            raise ValueError(
                "endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables"
            )

        self.headers: dict[str, str] = self._get_headers(headers)
        self.endpoint: str = endpoint
        self.event_types: list[API_EVENT_TYPES] | None = event_types
        self.callback_name: str | None = callback_name
        self.max_retries = max(0, int(max_retries or 0))
        retry_delay_value: Final = 0.0 if retry_delay is None else retry_delay
        self.retry_delay = max(0.0, float(retry_delay_value))
        self.timeout = timeout

        # Validate and store log_format
        if log_format is not None and log_format not in [
            "json_array",
            "ndjson",
            "single",
        ]:

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set GENERIC_LOGGER_ENDPOINT=https://logger.example.com/ingest in the proxy environment.
  2. Or pass endpoint= explicitly when constructing GenericAPILogger.
  3. If using callback_name, verify it exists in generic_api_compatible_callbacks.json — a miss only warns and leaves endpoint unset.

Example fix

# before
GenericAPILogger()  # no endpoint, no env var

# after
GenericAPILogger(endpoint="https://logger.example.com/ingest")
Defensive patterns

Strategy: validation

Validate before calling

import os

if "generic_api" in callbacks and not (os.getenv("GENERIC_LOGGER_ENDPOINT") or callback_name_in_json):
    raise ValueError("GENERIC_LOGGER_ENDPOINT is required when the generic_api callback is enabled")

Type guard

def generic_logger_ready(explicit_endpoint: str | None) -> bool:
    import os
    return bool(explicit_endpoint or os.getenv("GENERIC_LOGGER_ENDPOINT"))

Prevention

When it happens

Trigger: Adding 'generic_api' to callbacks with neither endpoint passed programmatically nor GENERIC_LOGGER_ENDPOINT exported, and no matching callback_name entry providing an endpoint.

Common situations: Env var missing in the deployed environment; typo in the var name; callback_name that does not exist in the JSON config file (only a warning is logged, then the missing endpoint surfaces here).

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/b2a21c8e00330628. Report an issue: GitHub.