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]

test(images): pin scalar-array edit params survive as repeated multipart fields

mateo-berri3ffec658fe48
diff --git a/tests/test_litellm/images/test_image_edit_extra_params.py b/tests/test_litellm/images/test_image_edit_extra_params.py
index 01490cdd988..088faafa9f3 100644
--- a/tests/test_litellm/images/test_image_edit_extra_params.py
+++ b/tests/test_litellm/images/test_image_edit_extra_params.py
@@ -100,6 +100,27 @@ def test_image_edit_flattens_nested_provider_params():
assert "generation_config" not in fields
+def test_image_edit_forwards_scalar_array_as_repeated_fields():
+ """A list-valued provider param must reach the backend as one repeated part
+ per element, not collapse to its last element under dict.update."""
+ captured = {}
+ client = HTTPHandler(client=httpx.Client(transport=httpx.MockTransport(_capture_image_edit_request(captured))))
+
+ litellm.image_edit(
+ model="openai/gpt-image-1",
+ image=PNG_BYTES,
+ prompt="add a hat",
+ api_key="sk-test",
+ api_base="https://edit.example/v1",
+ client=client,
+ loras=["style_a", "style_b", "style_c"],
+ )
+
+ body = captured["body"]
+ assert body.count(b'name="loras"') == 3
+ assert b"style_a" in body and b"style_b" in body and b"style_c" in body
+
+
@pytest.mark.asyncio
async def test_aimage_edit_forwards_extra_body():
"""aimage_edit used to drop extra_headers/extra_query/extra_body when