{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/linkup/search/transformation.py#L52-L88","documentation":"The Linkup search transformation authenticates with a Bearer token. resolve_server_api_key checks the caller-supplied api_key and the LINKUP_API_KEY environment variable; when neither yields a key, validate_environment raises ValueError before any search request is sent, because the Linkup API cannot be called anonymously.","triggerScenarios":"Any Linkup-backed web search (e.g. litellm.search / search provider 'linkup' or a model routed to linkup search) invoked without an api_key parameter and without LINKUP_API_KEY present in the environment.","commonSituations":"Env var missing in the deployed environment or CI; key stored under a different name (LINKUP_KEY, LINKUP_API_TOKEN); local shell has it but the server process does not.","solutions":["Set the env var: export LINKUP_API_KEY=lk-... in the process making the call","Or pass the key explicitly as api_key on the search call","Add LINKUP_API_KEY to your deployment secrets (.env, docker env, k8s secret)","Confirm with printenv LINKUP_API_KEY from the same runtime"],"exampleFix":"# before\nresults = litellm.search(query=\"latest ai news\", provider=\"linkup\")  # ValueError: LINKUP_API_KEY is not set\n\n# after\nos.environ[\"LINKUP_API_KEY\"] = \"lk-...\"\nresults = litellm.search(query=\"latest ai news\", provider=\"linkup\")","handlingStrategy":"validation","validationCode":"import os\n\nif not os.getenv(\"LINKUP_API_KEY\"):\n    raise SystemExit(\"Set LINKUP_API_KEY before using Linkup search\")\n# then: litellm.search(query=..., provider=\"linkup\") will not raise on auth setup","typeGuard":null,"tryCatchPattern":"try:\n    results = litellm.search(query=q, provider=\"linkup\")\nexcept ValueError as e:\n    if \"LINKUP_API_KEY is not set\" in str(e):\n        raise ConfigError(\"Missing LINKUP_API_KEY environment variable\") from e\n    raise","preventionTips":["Fail fast at startup when search providers are enabled but their keys are absent","Keep provider API keys in a single validated secrets map loaded at boot","Add LINKUP_API_KEY to deployment secret manifests and CI checks"],"tags":["linkup","web-search","api-key","env-var","authentication"],"backgroundTag":"missing-api-key","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}