diff --git a/litellm/llms/fal_ai/image_edit/transformation.py b/litellm/llms/fal_ai/image_edit/transformation.py index c8fc75211cb..b5399f50482 100644 --- a/litellm/llms/fal_ai/image_edit/transformation.py +++ b/litellm/llms/fal_ai/image_edit/transformation.py @@ -99,7 +99,9 @@ class FalAIImageEditConfig(BaseImageEditConfig): base_url = base_url.rstrip("/") # model arrives without provider prefix (e.g. "nano-banana-2/edit") # FAL API expects fal-ai/ prefix in the URL path - return f"{base_url}/fal-ai/{model}" + # Strip fal-ai/ if already present to avoid double prefix + model_path = model.removeprefix("fal-ai/") + return f"{base_url}/fal-ai/{model_path}" def _read_image_bytes( self, @@ -220,9 +222,7 @@ class FalAIImageEditConfig(BaseImageEditConfig): image_objects.append(ImageObject(url=single_image)) if not image_objects: - raise ValueError( - f"No images in Fal AI response: {response_data}" - ) + raise ValueError(f"No images in Fal AI response: {response_data}") return ImageResponse( created=int(time.time()), diff --git a/litellm/llms/fal_ai/image_generation/transformation.py b/litellm/llms/fal_ai/image_generation/transformation.py index 276452df6cc..e5e3b9d9788 100644 --- a/litellm/llms/fal_ai/image_generation/transformation.py +++ b/litellm/llms/fal_ai/image_generation/transformation.py @@ -53,7 +53,9 @@ class FalAIBaseConfig(BaseImageGenerationConfig): else: # Generic models need the model name in the URL path # model arrives without provider prefix (e.g. "nano-banana-2/edit") - complete_url = f"{complete_url}/fal-ai/{model}" + # Strip fal-ai/ if already present to avoid double prefix + model_path = model.removeprefix("fal-ai/") + complete_url = f"{complete_url}/fal-ai/{model_path}" return complete_url def validate_environment(