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 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 18:59:09 +02:00
parent 4cd88ba477
commit e013db9065
+4
View File
@@ -32,6 +32,10 @@ class VideoAPI:
seed: Optional[int] = None, seed: Optional[int] = None,
) -> str: ) -> str:
"""Submit an image-to-video task. Returns task_id.""" """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] image_field = VIDEO_IMAGE_FIELDS[model]
# kling-elements uses an array; all others use a scalar # kling-elements uses an array; all others use a scalar