{"record":{"id":"5bad0afedc186659","repo":"BerriAI/litellm","slug":"imagevariationconfig-implementa-transform-request-5bad0a","errorCode":null,"errorMessage":"ImageVariationConfig implementa 'transform_request_image_variation' for image variation models","messagePattern":"ImageVariationConfig implementa 'transform_request_image_variation' for image variation models","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/image_variations/transformation.py","lineNumber":112,"sourceCode":"        logging_obj: LiteLLMLoggingObj,\n        request_data: dict,\n        image: FileTypes,\n        optional_params: dict,\n        litellm_params: dict,\n        encoding: Any,\n        api_key: str | None = None,\n    ) -> ImageResponse:\n        pass\n\n    def transform_request(\n        self,\n        model: str,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        headers: dict,\n    ) -> dict:\n        raise NotImplementedError(\n            \"ImageVariationConfig implementa 'transform_request_image_variation' for image variation models\"\n        )\n\n    def transform_response(\n        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: ModelResponse,\n        logging_obj: LiteLLMLoggingObj,\n        request_data: dict,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        encoding: Any,\n        api_key: str | None = None,\n        json_mode: bool | None = None,\n    ) -> ModelResponse:\n        raise NotImplementedError(","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/image_variations/transformation.py#L94-L130","documentation":"In the image-variations base config, the chat-style transform_request hook (generic request pipeline signature with messages) is deliberately unimplemented and raises NotImplementedError. Image variation flows must go through transform_request_image_variation; hitting this stub means generic chat-transform plumbing was invoked on a variation config.","triggerScenarios":"A generic handler (shared with chat/completions) calls transform_request(model, messages, ...) on a config that only supports variations; routing a variation model through a completion-style endpoint; custom provider wiring that reuses the chat transformation pipeline.","commonSituations":"Custom providers modeled after the chat transformation interface; proxy routes that send variation models through the standard completions handler; refactors that unified request transforms under one signature.","solutions":["Invoke the image variation API path (litellm.image_variation / the variation handler) so transform_request_image_variation is used.","If your provider needs the generic signature, override transform_request in the subclass instead of inheriting the stub.","Correct route/handler mapping so variation models do not enter the chat pipeline.","Verify the provider config registered in the provider map is the variation config and the caller is a variation caller."],"exampleFix":"# before: variation model routed through generic chat pipeline\nhandler.transform_request(model, messages=[], ...)  # NotImplementedError\n\n# after: call the variation flow\nresp = litellm.image_variation(model='my-provider/model', image=f, n=2)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"from litellm.llms.base_llm.image_variations.transformation import ImageVariationConfig\n\ndef is_variation_only(config) -> bool:\n    return isinstance(config, ImageVariationConfig) and not hasattr(config.__class__, 'transform_request__overridden')","tryCatchPattern":"try:\n    result = handler.transform_request(...)\nexcept NotImplementedError as e:\n    if 'transform_request_image_variation' in str(e):\n        return config.transform_request_image_variation(...)  # route to variation API\n    raise","preventionTips":["Do not feed variation configs into generic chat pipelines; dispatch by modality.","In custom handlers, call the operation-specific transform methods, not the chat-shaped ones.","Cover dispatch routing in unit tests per registered model."],"tags":["image-variation","not-implemented","request-pipeline","dispatch"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}