{"record":{"id":"14d5d8466ddb7703","repo":"BerriAI/litellm","slug":"linkup-api-key-is-not-set-set-linkup-api-key-en","errorCode":null,"errorMessage":"LINKUP_API_KEY is not set. Set `LINKUP_API_KEY` environment variable.","messagePattern":"LINKUP_API_KEY is not set\\. Set `LINKUP_API_KEY` environment variable\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/linkup/search/transformation.py","lineNumber":70,"sourceCode":"    def validate_environment(\n        self,\n        headers: dict,\n        api_key: str | None = None,\n        api_base: str | None = None,\n        **kwargs,\n    ) -> dict:\n        \"\"\"\n        Validate environment and return headers.\n        \"\"\"\n        api_key = self.resolve_server_api_key(\n            caller_api_key=api_key,\n            caller_api_base=api_base,\n            key_env_vars=(\"LINKUP_API_KEY\",),\n            base_env_var=\"LINKUP_API_BASE\",\n            default_api_base=self.LINKUP_API_BASE,\n        )\n        if not api_key:\n            raise ValueError(\"LINKUP_API_KEY is not set. Set `LINKUP_API_KEY` environment variable.\")\n        headers[\"Authorization\"] = f\"Bearer {api_key}\"\n        headers[\"Content-Type\"] = \"application/json\"\n        return headers\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        optional_params: dict,\n        data: dict | list[dict] | None = None,\n        **kwargs,\n    ) -> str:\n        \"\"\"\n        Get complete URL for Search endpoint.\n        \"\"\"\n        api_base = api_base or get_secret_str(\"LINKUP_API_BASE\") or self.LINKUP_API_BASE\n\n        # Append \"/search\" to the api base if it's not already there\n        if not api_base.endswith(\"/search\"):","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/linkup/search/transformation.py#L52-L88","documentation":"The Linkup search provider (litellm/llms/linkup/search/transformation.py) requires a Bearer token on every request. resolve_server_api_key checks the caller-supplied api_key against the LINKUP_API_KEY environment variable (and related fallbacks); if neither yields a key, validate_environment raises ValueError before any HTTP call.","triggerScenarios":"Invoking Linkup web search (e.g. via litellm's search/tool-calling path with provider \"linkup\") without api_key and without LINKUP_API_KEY exported; key stored under a different variable name; env var missing in the deployed process.","commonSituations":"New Linkup integration where the key from the Linkup dashboard was never exported; key present locally but absent in Docker/CI; using api_base override (LINKUP_API_BASE) without also providing the key.","solutions":["export LINKUP_API_KEY=\"<your-key>\" (from the Linkup dashboard) in the environment running LiteLLM","Or pass api_key explicitly on the call / in the proxy environment config","For LiteLLM proxy, store the key in the environment or secret manager keyed as LINKUP_API_KEY","Verify with printenv LINKUP_API_KEY in the exact process context"],"exampleFix":"# before\nsearch_results = web_search(provider=\"linkup\", query=q)\n\n# after\nimport os\nos.environ[\"LINKUP_API_KEY\"] = \"lk_...\"\nsearch_results = web_search(provider=\"linkup\", query=q)","handlingStrategy":"validation","validationCode":"import os\n\ndef ensure_linkup_key(api_key: str | None = None) -> str:\n    key = api_key or os.getenv(\"LINKUP_API_KEY\")\n    if not key:\n        raise ValueError(\"LINKUP_API_KEY missing: set it before calling Linkup search\")\n    return key","typeGuard":null,"tryCatchPattern":"try:\n    results = web_search(provider=\"linkup\", query=q, api_key=ensure_linkup_key())\nexcept ValueError as e:\n    if \"LINKUP_API_KEY\" in str(e):\n        raise RuntimeError(\"Deploy config incomplete: LINKUP_API_KEY not provisioned\") from e","preventionTips":["Store LINKUP_API_KEY in the same secret manager/env pipeline as other provider keys","Add a config bootstrap check listing all required provider keys per enabled feature","If overriding LINKUP_API_BASE for a proxy, remember the key is still mandatory"],"tags":["linkup","authentication","environment"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}