Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(bfl): handle URL and file path inputs in image edit

Chesars00cf9550afcd
diff --git a/litellm/llms/black_forest_labs/image_edit/transformation.py b/litellm/llms/black_forest_labs/image_edit/transformation.py
index 1c381d118ed..95e3c946cc8 100644
--- a/litellm/llms/black_forest_labs/image_edit/transformation.py
+++ b/litellm/llms/black_forest_labs/image_edit/transformation.py
@@ -184,6 +184,16 @@ class BlackForestLabsImageEditConfig(BaseImageEditConfig):
elif isinstance(image, list):
# If it's a list, take the first image
return self._read_image_bytes(image[0])
+ elif isinstance(image, str):
+ if image.startswith(("http://", "https://")):
+ # Download image from URL
+ import httpx as _httpx
+ response = _httpx.get(image)
+ return response.content
+ else:
+ # Assume it's a file path
+ with open(image, "rb") as f:
+ return f.read()
elif hasattr(image, "read"):
# File-like object
pos = getattr(image, "tell", lambda: 0)()