{"record":{"id":"aafb47c0c4bd245c","repo":"BerriAI/litellm","slug":"api-base-is-required-aafb47","errorCode":null,"errorMessage":"api_base is required","messagePattern":"api_base is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/evals/transformation.py","lineNumber":81,"sourceCode":"    def get_complete_url(\n        self,\n        api_base: str | None,\n        endpoint: str,\n        eval_id: str | None = None,\n    ) -> str:\n        \"\"\"\n        Get the complete URL for the API request\n\n        Args:\n            api_base: Base API URL\n            endpoint: API endpoint (e.g., 'evals', 'evals/{id}')\n            eval_id: Optional eval ID for specific eval operations\n\n        Returns:\n            Complete URL\n        \"\"\"\n        if api_base is None:\n            raise ValueError(\"api_base is required\")\n        return f\"{api_base}/v1/{endpoint}\"\n\n    @abstractmethod\n    def transform_create_eval_request(\n        self,\n        create_request: CreateEvalRequest,\n        litellm_params: GenericLiteLLMParams,\n        headers: dict,\n    ) -> dict:\n        \"\"\"\n        Transform create eval request to provider-specific format\n\n        Args:\n            create_request: Eval creation parameters\n            litellm_params: LiteLLM parameters\n            headers: Request headers\n\n        Returns:","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/evals/transformation.py#L63-L99","documentation":"Thrown by the base evals transformation config when building the request URL for the Evals API (GET/POST /v1/evals). The get_complete_url helper refuses to construct '{api_base}/v1/{endpoint}' when api_base is None, because the resulting URL would be invalid. Every LiteLLM Evals provider config relies on this method, so a missing base URL fails fast before any HTTP call is made.","triggerScenarios":"Calling litellm.eval creation/listing APIs for a provider whose config was instantiated without an api_base (e.g. custom/self-hosted evals endpoint), or passing litellm_params without api_base/api_key env vars set, so the resolved api_base arrives as None at get_complete_url(api_base=None, endpoint='evals').","commonSituations":"Running litellm.evals against a custom OpenAI-compatible endpoint while forgetting OPENAI_API_BASE / api_base param; proxy deployments where the evals router model entry lacks api_base; env var typos (OPENAI_BASE_URL vs OPENAI_API_BASE) in CI.","solutions":["Pass api_base explicitly in litellm_params (e.g. litellm_params={'api_base': 'https://your-host'}) when invoking evals APIs.","Set the provider base URL env var (e.g. OPENAI_API_BASE or the matching <PROVIDER>_API_BASE) before the call.","If using the proxy, add api_base to the model config entry (model_info/litellm_params) used for evals.","Subclassing a BaseEvalConfig: override get_complete_url instead of relying on the default when your provider builds URLs differently."],"exampleFix":"// before\nawait litellm.acreate_eval(create_request=req, litellm_params=GenericLiteLLMParams())  # api_base None -> ValueError\n\n// after\nparams = GenericLiteLLMParams(api_base='https://api.openai.com')\nawait litellm.acreate_eval(create_request=req, litellm_params=params)","handlingStrategy":"validation","validationCode":"from litellm import GenericLiteLLMParams\n\ndef can_build_eval_url(litellm_params: GenericLiteLLMParams) -> bool:\n    return bool(getattr(litellm_params, 'api_base', None))\n\nassert can_build_eval_url(params), 'Set api_base (or OPENAI_API_BASE) before calling evals APIs'","typeGuard":null,"tryCatchPattern":"try:\n    await litellm.acreate_eval(...)\nexcept ValueError as e:\n    if 'api_base is required' in str(e):\n        raise ConfigError('Evals provider missing api_base') from e\n    raise","preventionTips":["Set provider base URLs via env vars at deploy time, not ad hoc per call.","Add a startup smoke test that builds one eval URL per configured provider.","Centralize api_base in one config object reused by all eval calls."],"tags":["configuration","evals","api-base","url-construction"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}