BerriAI/litellm · error · ValueError

NIMBLE_API_KEY is not set. Set `NIMBLE_API_KEY` environment…

Error message

NIMBLE_API_KEY is not set. Set `NIMBLE_API_KEY` environment variable.

What it means

Error "NIMBLE_API_KEY is not set. Set `NIMBLE_API_KEY` environment variable." thrown in BerriAI/litellm.

Solutions

  1. Export NIMBLE_API_KEY before calling the Nimble search route.

When it happens

Trigger: Thrown at litellm/llms/nimble/search/transformation.py:110 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at litellm/llms/nimble/search/transformation.py:110

        api_key: str | None = None,
        api_base: str | None = None,
        **kwargs: object,  # kwargs-ok: BaseSearchConfig.validate_environment signature
    ) -> dict[str, str]:  # mutable-ok: the http handler passes this straight to httpx as headers
        """
        Validate environment and return headers.

        Returns a new dict rather than mutating ``headers``: the http handler calls this
        a second time after ``litellm/search/main.py`` already did, so it has to be idempotent.
        """
        resolved_api_key: Final = self.resolve_server_api_key(
            caller_api_key=api_key,
            caller_api_base=api_base,
            key_env_vars=("NIMBLE_API_KEY",),
            base_env_var="NIMBLE_API_BASE",
            default_api_base=self.NIMBLE_API_BASE,
        )
        if not resolved_api_key:
            raise ValueError("NIMBLE_API_KEY is not set. Set `NIMBLE_API_KEY` environment variable.")
        return {  # mutable-ok: httpx requires a plain dict of headers
            **headers,
            "Authorization": f"Bearer {resolved_api_key}",
            "Content-Type": "application/json",
            # Nimble's client-attribution header: names the calling software, nothing else.
            "X-Client-Source": "litellm",
        }

    def get_complete_url(
        self,
        api_base: str | None,
        optional_params: dict[str, object],  # mutable-ok: BaseSearchConfig.get_complete_url signature
        data: dict[str, object] | list[dict[str, object]] | None = None,  # mutable-ok: base signature
        **kwargs: object,  # kwargs-ok: BaseSearchConfig.get_complete_url signature
    ) -> str:
        resolved_base: Final = (api_base or get_secret_str("NIMBLE_API_BASE") or self.NIMBLE_API_BASE).rstrip("/")
        if resolved_base.endswith("/search"):
            return resolved_base

View on GitHub (pinned to 77b7c6c40c)