{"record":{"id":"680da7bbbdab0453","repo":"BerriAI/litellm","slug":"parallel-api-key-is-not-set-set-parallel-api-key","errorCode":null,"errorMessage":"PARALLEL_API_KEY is not set. Set `PARALLEL_API_KEY` environment variable.","messagePattern":"PARALLEL_API_KEY is not set\\. Set `PARALLEL_API_KEY` environment variable\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/parallel_ai/search/transformation.py","lineNumber":78,"sourceCode":"    def ui_friendly_name() -> str:\n        return \"Parallel AI\"\n\n    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        api_key = self.resolve_server_api_key(\n            caller_api_key=api_key,\n            caller_api_base=api_base,\n            key_env_vars=(\"PARALLEL_AI_API_KEY\", \"PARALLEL_API_KEY\"),\n            base_env_var=\"PARALLEL_AI_API_BASE\",\n            default_api_base=self.PARALLEL_AI_API_BASE,\n        )\n        if not api_key:\n            raise ValueError(\"PARALLEL_API_KEY is not set. Set `PARALLEL_API_KEY` environment variable.\")\n        headers[\"x-api-key\"] = 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        api_base = api_base or get_secret_str(\"PARALLEL_AI_API_BASE\") or self.PARALLEL_AI_API_BASE\n\n        api_base = api_base.rstrip(\"/\")\n        if not api_base.endswith(\"/v1/search\"):\n            api_base = f\"{api_base.removesuffix('/v1')}/v1/search\"\n\n        return api_base","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/parallel_ai/search/transformation.py#L60-L96","documentation":"Parallel AI's search transformation resolves credentials via resolve_server_api_key, checking the PARALLEL_AI_API_KEY and PARALLEL_API_KEY environment variables (plus caller-passed keys). If nothing resolves it raises this ValueError. The message names only PARALLEL_API_KEY, but PARALLEL_AI_API_KEY is the primary variable and works too.","triggerScenarios":"Invoking litellm's Parallel AI search support without an api_key argument while neither PARALLEL_AI_API_KEY nor PARALLEL_API_KEY is present in the environment.","commonSituations":"Env vars missing in containers/serverless deployments; misspelled variable names; key configured on a different litellm proxy deployment than the one serving the request.","solutions":["export PARALLEL_AI_API_KEY=... (or PARALLEL_API_KEY) in the environment running litellm","Pass api_key explicitly in the call or deployment configuration","For litellm proxy, declare the key in config.yaml rather than relying on ambient env","Add a startup check asserting one of the two variables resolves"],"exampleFix":"// before\nres = litellm.parallel_ai_search(query=\"...\")  # no key anywhere\n\n// after\nimport os\nres = litellm.parallel_ai_search(query=\"...\", api_key=os.environ[\"PARALLEL_AI_API_KEY\"])","handlingStrategy":"validation","validationCode":"import os\n\ndef parallel_key_present() -> bool:\n    return bool(os.getenv(\"PARALLEL_AI_API_KEY\") or os.getenv(\"PARALLEL_API_KEY\"))\n\nassert parallel_key_present(), \"Set PARALLEL_AI_API_KEY (or PARALLEL_API_KEY)\"  # run at startup","typeGuard":null,"tryCatchPattern":"try/except ValueError around the search call can convert this deterministic config failure into an ops-facing configuration error; retrying is pointless.","preventionTips":["Assert one of PARALLEL_AI_API_KEY / PARALLEL_API_KEY at startup","Prefer passing api_key explicitly over ambient env in multi-tenant deployments","Include env checks in CI for services that use Parallel AI"],"tags":["parallel-ai","search","authentication","env-var","litellm"],"backgroundTag":"missing-api-key","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}