BerriAI/litellm · error · ValueError
LINKUP_API_KEY is not set. Set `LINKUP_API_KEY` environment
Error message
LINKUP_API_KEY is not set. Set `LINKUP_API_KEY` environment variable.
What it means
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.
Source
Thrown at litellm/llms/linkup/search/transformation.py:70
def validate_environment(
self,
headers: dict,
api_key: str | None = None,
api_base: str | None = None,
**kwargs,
) -> dict:
"""
Validate environment and return headers.
"""
api_key = self.resolve_server_api_key(
caller_api_key=api_key,
caller_api_base=api_base,
key_env_vars=("LINKUP_API_KEY",),
base_env_var="LINKUP_API_BASE",
default_api_base=self.LINKUP_API_BASE,
)
if not api_key:
raise ValueError("LINKUP_API_KEY is not set. Set `LINKUP_API_KEY` environment variable.")
headers["Authorization"] = f"Bearer {api_key}"
headers["Content-Type"] = "application/json"
return headers
def get_complete_url(
self,
api_base: str | None,
optional_params: dict,
data: dict | list[dict] | None = None,
**kwargs,
) -> str:
"""
Get complete URL for Search endpoint.
"""
api_base = api_base or get_secret_str("LINKUP_API_BASE") or self.LINKUP_API_BASE
# Append "/search" to the api base if it's not already there
if not api_base.endswith("/search"):View on GitHub (pinned to 6c2dcb801b)
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
Example fix
# before search_results = web_search(provider="linkup", query=q) # after import os os.environ["LINKUP_API_KEY"] = "lk_..." search_results = web_search(provider="linkup", query=q)
Defensive patterns
Strategy: validation
Validate before calling
import os
def ensure_linkup_key(api_key: str | None = None) -> str:
key = api_key or os.getenv("LINKUP_API_KEY")
if not key:
raise ValueError("LINKUP_API_KEY missing: set it before calling Linkup search")
return key Try / catch
try:
results = web_search(provider="linkup", query=q, api_key=ensure_linkup_key())
except ValueError as e:
if "LINKUP_API_KEY" in str(e):
raise RuntimeError("Deploy config incomplete: LINKUP_API_KEY not provisioned") from e Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Missing Azure Document Intelligence API Key - Set AZURE_DOCU
- Missing Azure AI API Key - A call is being made to Azure AI
- Missing required OCI credentials: oci_user, oci_fingerprint,
- Error: {response.status_code} - {response.text}
- Missing Authorization header
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/14d5d8466ddb7703.
Report an issue: GitHub.