{"record":{"id":"1903c0c920ff79ca","repo":"BerriAI/litellm","slug":"missing-api-base-a-call-is-being-made-to-llm-pro","errorCode":null,"errorMessage":"Missing API Base - A call is being made to LLM Provider but no api base is set either in the environment variables ({LLM_PROVIDER}_API_KEY) or via params","messagePattern":"Missing API Base - A call is being made to LLM Provider but no api base is set either in the environment variables \\((.+?)_API_KEY\\) or via params","errorType":"exception","errorClass":"DatabricksException","httpStatus":400,"severity":"error","filePath":"litellm/llms/databricks/common_utils.py","lineNumber":364,"sourceCode":"            headers = headers or {}\n            headers[\"Authorization\"] = f\"Bearer {access_token}\"\n            headers[\"Content-Type\"] = \"application/json\"\n        elif api_key is None and not headers:\n            if custom_endpoint is True:\n                raise DatabricksException(\n                    status_code=400,\n                    message=\"Missing API Key - A call is being made to LLM Provider but no key is set either in the environment variables ({LLM_PROVIDER}_API_KEY) or via params\",\n                )\n            else:\n                # Fallback to Databricks SDK (registers partner telemetry)\n                verbose_logger.debug(\"Using Databricks SDK for authentication\")\n                api_base, headers = self._get_databricks_credentials(\n                    api_base=api_base, api_key=api_key, headers=headers\n                )\n\n        if api_base is None:\n            if custom_endpoint:\n                raise DatabricksException(\n                    status_code=400,\n                    message=\"Missing API Base - A call is being made to LLM Provider but no api base is set either in the environment variables ({LLM_PROVIDER}_API_KEY) or via params\",\n                )\n            else:\n                api_base, headers = self._get_databricks_credentials(\n                    api_base=api_base, api_key=api_key, headers=headers\n                )\n\n        if headers is None:\n            headers = {\n                \"Authorization\": f\"Bearer {api_key}\",\n                \"Content-Type\": \"application/json\",\n            }\n        else:\n            if api_key is not None:\n                headers.update({\"Authorization\": f\"Bearer {api_key}\"})\n\n        if api_key is not None:","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/databricks/common_utils.py#L346-L382","documentation":"Raised when a custom Databricks endpoint is used and no api base URL could be resolved after the full chain: explicit api_base argument, DATABRICKS_API_BASE env var, and (for custom endpoints) the SDK fallback which is skipped. Note the message text incorrectly references _API_KEY; the actual missing item is the base URL.","triggerScenarios":"custom_endpoint=True with no api_base argument, no DATABRICKS_API_BASE in the environment — LiteLLM will not guess a URL for a custom endpoint and raises this 400 before any request.","commonSituations":"Configuring Databricks-through-gateway where the gateway URL env var was forgotten; renaming env vars during a migration; YAML config indentation errors putting api_base under the wrong key.","solutions":["Set DATABRICKS_API_BASE to the full serving-endpoint URL (must include /serving-endpoints for native endpoints)","Or pass api_base in litellm_params / the completion call","For gateway URLs, confirm whether the /serving-endpoints suffix should be omitted (follow your gateway's docs)","Double-check the env var actually exports in the runtime shell/container"],"exampleFix":"# before\n# custom endpoint, base never set\n\n# after\nexport DATABRICKS_API_BASE=\"https://my-gateway.internal/databricks\"\nexport DATABRICKS_API_KEY=\"gw-token\"","handlingStrategy":"validation","validationCode":"api_base = os.getenv(\"DATABRICKS_API_BASE\") or params.get(\"api_base\")\nif custom_endpoint and not api_base:\n    raise RuntimeError(\"Custom Databricks endpoint requires api_base (gateway URL)\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.completion(model=m, messages=msgs)\nexcept Exception as e:\n    if \"Missing API Base\" in str(e):\n        raise ConfigError(\"Set DATABRICKS_API_BASE / api_base for the custom endpoint\") from e\n    raise","preventionTips":["Validate proxy config YAML at deploy time: every databricks/ model must declare api_base","Remember the message text mentions _API_KEY but the missing field is the base URL — check api_base first"],"tags":["databricks","config","custom-endpoint","base-url"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}