{"record":{"id":"c2b3612f16bab19b","repo":"BerriAI/litellm","slug":"apiserpent-api-key-is-not-set-set-apiserpent-api","errorCode":null,"errorMessage":"APISERPENT_API_KEY is not set. Set `APISERPENT_API_KEY` environment variable.","messagePattern":"APISERPENT_API_KEY is not set\\. Set `APISERPENT_API_KEY` environment variable\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/apiserpent/search/transformation.py","lineNumber":64,"sourceCode":"    def _is_deep_search(optional_params: dict) -> bool:\n        return bool(optional_params.get(DEEP_SEARCH_PARAM))\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=(\"APISERPENT_API_KEY\",),\n            base_env_var=\"APISERPENT_API_BASE\",\n            default_api_base=APISERPENT_BASE,\n        )\n        if not api_key:\n            raise ValueError(\"APISERPENT_API_KEY is not set. Set `APISERPENT_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        \"\"\"\n        Build the search URL. APISerpent uses GET, so the transformed request is\n        serialized into the query string. The endpoint path (quick vs deep) is\n        always applied; an ``api_base`` / ``APISERPENT_API_BASE`` override only\n        changes the host. The ``endswith`` guard keeps this idempotent, since the\n        handler re-invokes this method with the already-resolved URL as api_base.\n        \"\"\"","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/apiserpent/search/transformation.py#L46-L82","documentation":"Error \"APISERPENT_API_KEY is not set. Set `APISERPENT_API_KEY` environment variable.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/apiserpent/search/transformation.py:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the APISERPENT_API_KEY environment variable or pass api_key."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}