{"record":{"id":"fb8699b3318c1841","repo":"BerriAI/litellm","slug":"api-base-is-required-fb8699","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/image_edit/transformation.py","lineNumber":90,"sourceCode":"    ) -> dict:\n        return {}\n\n    @abstractmethod\n    def get_complete_url(\n        self,\n        model: str,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"\n        OPTIONAL\n\n        Get the complete url for the request\n\n        Some providers need `model` in `api_base`\n        \"\"\"\n        if api_base is None:\n            raise ValueError(\"api_base is required\")\n        return api_base\n\n    @abstractmethod\n    def transform_image_edit_request(\n        self,\n        model: str,\n        prompt: str | None,\n        image: FileTypes | None,\n        image_edit_optional_request_params: dict,\n        litellm_params: GenericLiteLLMParams,\n        headers: dict,\n    ) -> tuple[dict, RequestFiles]:\n        pass\n\n    def finalize_image_edit_request_data(self, data: dict, resolved_request_url: str) -> dict:\n        \"\"\"\n        Last pass on the request dict after ``transform_image_edit_request``, using the\n        exact URL string used for the HTTP POST (same as ``get_complete_url`` output).","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/image_edit/transformation.py#L72-L108","documentation":"Thrown by the base image-edit transformation when get_complete_url is called with api_base=None. The default implementation simply returns api_base for OpenAI-style providers, so a None base URL (nothing to POST the multipart edit to) is rejected up front with a clear ValueError.","triggerScenarios":"Calling litellm.image_edit for a provider whose config/params leave api_base unset — e.g. custom OpenAI-compatible host without OPENAI_API_BASE, a proxy model entry missing api_base, or a provider subclass that forgot to override get_complete_url and also lacks a base URL.","commonSituations":"Running image edits against Azure/OpenAI-compatible deployments without setting the base URL env var; new custom provider configs that define transform_image_edit_request but rely on the default get_complete_url; dockerized deployments losing env vars.","solutions":["Pass api_base in the call: litellm.image_edit(..., api_base='https://your-host/v1').","Set the provider's base URL env var (e.g. OPENAI_API_BASE) before calling.","In proxy deployments, add api_base to the model's litellm_params in config.yaml.","Custom provider: override get_complete_url in your config class to construct the URL from your own defaults."],"exampleFix":"# before\nresp = litellm.image_edit(model='my-provider/gpt-image-1', prompt='add a hat', image=f)\n\n# after\nresp = litellm.image_edit(model='my-provider/gpt-image-1', prompt='add a hat', image=f,\n                           api_base='https://my-provider.example.com/v1/images/edits')","handlingStrategy":"validation","validationCode":"def assert_image_edit_ready(api_base: str | None) -> None:\n    if not api_base:\n        raise ConfigError('image_edit requires api_base or OPENAI_API_BASE')","typeGuard":null,"tryCatchPattern":"try:\n    litellm.image_edit(...)\nexcept ValueError as e:\n    if 'api_base is required' in str(e):\n        api_base = os.environ.get('OPENAI_API_BASE')\n        if not api_base:\n            raise\n        return litellm.image_edit(..., api_base=api_base)\n    raise","preventionTips":["Always pass api_base explicitly for custom providers instead of relying on defaults.","Add env-var checks to your deployment's readiness probe.","Wrap provider calls in a small client class that owns base-URL configuration."],"tags":["image-edit","api-base","configuration","url-construction"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}