From e013db9065e60a4b31aa77c3026b121ebb09e532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Fri, 10 Apr 2026 18:59:09 +0200 Subject: [PATCH] fix: strip data URI prefix before sending image to video API The Freepik video generation API expects raw base64, not a data URI (data:image/jpeg;base64,...). Strip the prefix in VideoAPI.generate before building the payload. Co-Authored-By: Claude Sonnet 4.6 --- freepik_cli/api/videos.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/freepik_cli/api/videos.py b/freepik_cli/api/videos.py index d3b01dc..685fc57 100644 --- a/freepik_cli/api/videos.py +++ b/freepik_cli/api/videos.py @@ -32,6 +32,10 @@ class VideoAPI: seed: Optional[int] = None, ) -> str: """Submit an image-to-video task. Returns task_id.""" + # Video API expects raw base64, not a data URI + if ";base64," in image_b64: + image_b64 = image_b64.split(";base64,", 1)[1] + image_field = VIDEO_IMAGE_FIELDS[model] # kling-elements uses an array; all others use a scalar