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(fal_ai): keep image data serializer none safe

kerryc12c20083fbc
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index a2d92491188..8d327b337a7 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -2552,8 +2552,8 @@ class ImageResponse(OpenAIImageResponse, BaseLiteLLMOpenAIResponseObject):
model_config = ConfigDict(extra="allow", protected_namespaces=())
@field_serializer("data")
- def _serialize_image_data(self, data: list[OpenAIImage]) -> list[dict[str, object]]:
- return [image.model_dump() for image in data]
+ def _serialize_image_data(self, data: list[OpenAIImage] | None) -> list[dict[str, object]] | None:
+ return None if data is None else [image.model_dump() for image in data]
def __init__(
self,