mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(fal_ai): prevent double fal-ai/ prefix in generic model URL construction
When model is configured as fal_ai/fal-ai/model-name, the provider prefix stripping leaves fal-ai/ intact, causing get_complete_url() to produce fal-ai/fal-ai/model-name. Use removeprefix() to strip it before re-adding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d90af8c8bc
commit
e3cda5f919
2 changed files with 7 additions and 5 deletions
|
|
@ -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()),
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue