{"record":{"id":"db4029d957974b11","repo":"BerriAI/litellm","slug":"lemonade-api-base-is-not-set-please-set-the-envir","errorCode":null,"errorMessage":"LEMONADE_API_BASE is not set. Please set the environment variable to query Lemonade's /models endpoint.","messagePattern":"LEMONADE_API_BASE is not set\\. Please set the environment variable to query Lemonade's /models endpoint\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/lemonade/chat/transformation.py","lineNumber":84,"sourceCode":"        return super().get_config()\n\n    def get_models(self, api_key: str | None = None, api_base: str | None = None):\n        \"\"\"\n        Get available models from Lemonade API.\n\n        This method queries the Lemonade /models endpoint to retrieve the list of available models.\n\n        Args:\n            api_key: Optional API key for authenticated Lemonade servers\n            api_base: Optional API base URL (defaults to LEMONADE_API_BASE env var or http://localhost:8000)\n\n        Returns:\n            List of model names prefixed with \"lemonade/\"\n        \"\"\"\n        api_base, api_key = self._get_openai_compatible_provider_info(api_base=api_base, api_key=api_key)\n\n        if api_base is None:\n            raise ValueError(\n                \"LEMONADE_API_BASE is not set. Please set the environment variable to query Lemonade's /models endpoint.\"\n            )\n\n        # Getting the list of models from lemonade\n        try:\n            response: Final = litellm.module_level_client.get(\n                url=f\"{api_base}/models\",\n                headers=self._get_auth_headers(api_key),\n            )\n        except Exception as e:\n            raise ValueError(\n                f\"Failed to fetch models from Lemonade. Set Lemonade API Base via `LEMONADE_API_BASE` environment variable. Error: {e}\"\n            )\n\n        if response.status_code != 200:\n            raise ValueError(\n                f\"Failed to fetch models from Lemonade. Status code: {response.status_code}, Response: {response.text}\"\n            )","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/lemonade/chat/transformation.py#L66-L102","documentation":"Lemonade get_models needs a base URL to query {api_base}/models. It resolves api_base via _get_openai_compatible_provider_info (LEMONADE_API_BASE env var or explicit parameter) and, if it is still None, raises ValueError telling you to set LEMONADE_API_BASE before the /models query can be made.","triggerScenarios":"Calling lemonade model discovery (litellm.get_models / get_models on the lemonade config) with neither an api_base argument nor LEMONADE_API_BASE set in the process; unlike the chat path there is no localhost fallback in this check.","commonSituations":"Running on a fresh machine/CI where the env var was never set; .env not loaded before the discovery call; assuming the default http://localhost:8000 applies to model listing when the env var is absent.","solutions":["Export LEMONADE_API_BASE (e.g. export LEMONADE_API_BASE=http://localhost:8000) in the calling process","Or pass api_base directly to the get_models call","Add the variable to your .env / container env so every process that lists models has it","Verify with printenv LEMONADE_API_BASE from the same runtime"],"exampleFix":"# before\nmodels = LemonadeConfig().get_models()  # ValueError: LEMONADE_API_BASE is not set\n\n# after\nos.environ[\"LEMONADE_API_BASE\"] = \"http://localhost:8000\"\nmodels = LemonadeConfig().get_models()\n# or: models = LemonadeConfig().get_models(api_base=\"http://localhost:8000\")","handlingStrategy":"validation","validationCode":"import os\n\nLEMONADE_BASE = os.getenv(\"LEMONADE_API_BASE\")\nif not LEMONADE_BASE:\n    raise SystemExit(\"Set LEMONADE_API_BASE (e.g. http://localhost:8000) before listing models\")\n# then: LemonadeConfig().get_models() or litellm model discovery works","typeGuard":null,"tryCatchPattern":"try:\n    models = LemonadeConfig().get_models()\nexcept ValueError as e:\n    if \"LEMONADE_API_BASE is not set\" in str(e):\n        raise ConfigError(\"LEMONADE_API_BASE missing\") from e\n    raise","preventionTips":["Default LEMONADE_API_BASE in your app's env loading (e.g. http://localhost:8000) if you always run local","Add the variable to CI fixtures so model discovery tests never hit the guard","Check required env vars in a startup validation step"],"tags":["lemonade","get-models","env-var","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}