{"record":{"id":"e1d99e6ab3b952a2","repo":"BerriAI/litellm","slug":"vllm-api-base-not-found","errorCode":null,"errorMessage":"VLLM api base not found","messagePattern":"VLLM api base not found","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vllm/passthrough/transformation.py","lineNumber":27,"sourceCode":"\n\nclass VLLMPassthroughConfig(VLLMModelInfo, BasePassthroughConfig):\n    def is_streaming_request(self, endpoint: str, request_data: dict) -> bool:\n        return \"stream\" in request_data\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        endpoint: str,\n        request_query_params: dict | None,\n        litellm_params: dict,\n    ) -> tuple[\"URL\", str]:\n        base_target_url: Final = self.get_api_base(api_base)\n\n        if base_target_url is None:\n            raise Exception(\"VLLM api base not found\")\n\n        return (\n            self.format_url(endpoint, base_target_url, request_query_params),\n            base_target_url,\n        )\n","sourceCodeStart":9,"sourceCodeEnd":33,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vllm/passthrough/transformation.py#L9-L33","documentation":"Raised by the vLLM passthrough config when building the target URL for a passthrough request (e.g. client.vllm endpoints or /vllm/{endpoint} routes on the LiteLLM proxy). get_api_base() resolves api_base from the argument or the VLLM_API_BASE environment variable; if both are unset the URL cannot be constructed and a plain Exception('VLLM api base not found') is raised. Note: the underlying get_api_base in litellm/llms/vllm/common_utils.py:47-53 usually raises its own ValueError mentioning VLLM_API_BASE, so this line is the defensive backstop.","triggerScenarios":"Calling litellm.vllm passthrough methods (client.vllm.<endpoint>) without api_base and without VLLM_API_BASE set; proxy deployments using the /vllm passthrough route where the VLLM_API_BASE env var was never configured; passing api_base=None explicitly.","commonSituations":"Self-hosting a vLLM server and using the passthrough API while forgetting the env var; proxy config.yaml defines the model but the passthrough route needs the dedicated VLLM_API_BASE environment variable; port-forward changes leaving a stale/empty var.","solutions":["Set VLLM_API_BASE in the environment, e.g. export VLLM_API_BASE=http://localhost:8000.","Or pass api_base explicitly to the passthrough call / litellm_params.","On the LiteLLM proxy, add VLLM_API_BASE to the proxy's environment (environment_variables in config.yaml or the container env).","Verify with: echo $VLLM_API_BASE and curl $VLLM_API_BASE/v1/models to confirm the server is reachable."],"exampleFix":"# before\nresp = client.vllm.pooling(inputs=[[1.0, 2.0]])  # raises: VLLM api base not found\n\n# after\nimport os\nos.environ[\"VLLM_API_BASE\"] = \"http://localhost:8000\"\nresp = client.vllm.pooling(inputs=[[1.0, 2.0]])","handlingStrategy":"validation","validationCode":"import os\n\nVLLM_URL = os.getenv(\"VLLM_API_BASE\") or os.getenv(\"api_base\")\nif not VLLM_URL:\n    raise RuntimeError(\"VLLM_API_BASE is not set - required for vLLM passthrough calls\")\n# then safe to use passthrough endpoints\nresp = client.vllm.pooling(inputs=[[1.0, 2.0]])","typeGuard":"const hasVllmBase = (cfg: Record<string, string | undefined>): boolean =>\n  Boolean(cfg.VLLM_API_BASE ?? cfg.api_base);","tryCatchPattern":"try:\n    resp = client.vllm.some_endpoint(...)\nexcept Exception as e:\n    if \"api base not found\" in str(e).lower():\n        raise RuntimeError(\"Set VLLM_API_BASE before using the vLLM passthrough API\") from e\n    raise","preventionTips":["Set VLLM_API_BASE in the same deploy step that starts the vLLM server.","Fail fast at boot: assert os.environ.get('VLLM_API_BASE') in your app's config check.","Add a healthcheck that curls $VLLM_API_BASE/v1/models before accepting traffic."],"tags":["vllm","passthrough","api-base","environment-variable","litellm"],"backgroundTag":"missing-api-base-url","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}