{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/databricks/common_utils.py#L346-L382","documentation":"After all resolution paths, api_base is still None while custom_endpoint is true, so no SDK fallback is attempted and LiteLLM raises 400 'Missing API Base'. Be aware the shipped message contains a copy-paste bug: it says '{LLM_PROVIDER}_API_KEY' where it means the API _BASE_ — the missing value is the base URL, not the key.","triggerScenarios":"Custom-endpoint Databricks invocation with no api_base argument, no DATABRICKS_API_BASE env var (or a misspelled variant like DATABRICKS_HOST which this code does not read), and the SDK path unavailable — the custom_endpoint flag blocks the fallback that would otherwise derive the host.","commonSituations":"Router/proxy deployment YAML missing the api_base field; container launched without the env var; copy-pasted configs where the base was replaced by a placeholder; developers misled by the '_API_KEY' wording in the message and re-setting the key instead.","solutions":["Provide the base URL: export DATABRICKS_API_BASE=https://<workspace-host>/serving-endpoints, or api_base= on the call/deployment","Ignore the '_API_KEY' wording — it is a known message bug; the missing item is the API base","If you expected SDK-derived auth, remove the custom-endpoint configuration so the SDK fallback can resolve the host"],"exampleFix":"# before\nos.environ.pop('DATABRICKS_API_BASE', None)\nlitellm.completion(model='databricks/my-model', messages=msgs)  # 400 'Missing API Base'\n\n# after\nos.environ['DATABRICKS_API_BASE'] = 'https://adb-1234.0.azuredatabricks.net/serving-endpoints'\nlitellm.completion(model='databricks/my-model', messages=msgs)","handlingStrategy":"validation","validationCode":"import os\n\ndef databricks_base_set(api_base: str | None) -> bool:\n    return api_base is not None or bool(os.getenv('DATABRICKS_API_BASE'))\n\nif not databricks_base_set(cfg.get('api_base')):\n    raise RuntimeError('custom databricks endpoint requires api_base or DATABRICKS_API_BASE')","typeGuard":null,"tryCatchPattern":"try:\n    litellm.completion(model='databricks/my-model', messages=msgs)\nexcept Exception as e:\n    if 'Missing API Base' in str(e):\n        raise ConfigError('set DATABRICKS_API_BASE (note: error text mentions _API_KEY, that is a litellm message bug)') from e\n    raise","preventionTips":["Remember the message text says _API_KEY but means _API_BASE - do not chase the wrong config","Lint deployment configs so every custom endpoint defines api_base explicitly"],"tags":["databricks","api-base","configuration","error-message-bug"],"backgroundTag":"missing-api-base","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}