{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/lemonade/chat/transformation.py#L66-L102","documentation":"The Lemonade provider (AMD's LLM inference server) has no usable api_base default by the time get_models runs its check, so listing models raises ValueError. Resolution order is the api_base argument, then provider env vars, then LEMONADE_API_BASE; if all are None the /models query cannot proceed.","triggerScenarios":"Calling the models-list path (e.g. proxy model population or provider get_models) without api_base and without LEMONADE_API_BASE in the environment.","commonSituations":"Fresh setup expecting the documented http://localhost:8000 default but the env var fallback chain resolves to None; Lemonade server not started yet; env var set in a different session/container.","solutions":["export LEMONADE_API_BASE=\"http://localhost:8000\" (or your Lemonade server URL) and restart the process","Or pass api_base explicitly when calling get_models / configuring the model entry","Confirm the Lemonade server is running: curl http://localhost:8000/models"],"exampleFix":"# before\nmodels = provider.get_models()  # ValueError\n\n# after\nimport os\nos.environ[\"LEMONADE_API_BASE\"] = \"http://localhost:8000\"\nmodels = provider.get_models()","handlingStrategy":"validation","validationCode":"import os\n\ndef ensure_lemonade_base() -> str:\n    base = os.getenv(\"LEMONADE_API_BASE\")\n    if not base:\n        raise ValueError(\"LEMONADE_API_BASE must be set before listing Lemonade models\")\n    return base","typeGuard":null,"tryCatchPattern":"try:\n    models = provider.get_models()\nexcept ValueError as e:\n    if \"LEMONADE_API_BASE is not set\" in str(e):\n        os.environ[\"LEMONADE_API_BASE\"] = \"http://localhost:8000\"\n        models = provider.get_models()","preventionTips":["Set LEMONADE_API_BASE explicitly even if you expect the localhost default — the fallback chain can yield None","Add the variable to your service manifest / .env loaded at process start","Health-check {base}/models on boot before populating model lists"],"tags":["lemonade","config","environment"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}