Hi everyone,
I’m building a workflow that generates a LinkedIn banner image (using Gemini image generation) and then animates it into a short video using the Veo 3.1 predictLongRunning API. The image generation works fine, but the Veo API call always fails with a 400 error.
What I’m trying to do:
- Generate an image using the Gemini gemini-3-pro-image-preview node (image edit mode with reference images)
- Take the output binary (edited) and send it to Veo 3.1 for image-to-video generation
- The Veo endpoint is: POST https://generativelanguage.googleapis.com/v1beta/models/veo-3.1-generate-preview:predictLongRunning
The request body I’m sending:
{
“instances”: [{
“prompt”: “Animate this static image with smooth motion…”,
“image”: {
“bytesBase64Encoded”: “”,
“mimeType”: “image/png”
}
}],
“parameters”: {
“aspectRatio”: “9:16”,
“durationSeconds”: 8,
“personGeneration”: “allow_adult”
}
}
Errors I’ve encountered:
-
“referenceImages isn’t supported by this model” — When I tried using parameters.referenceImages with inlineData format and referenceType: “asset” (as shown in the Veo 3.1 docs), the API rejected it.
-
“Unable to process input image” (400 INVALID_ARGUMENT) — When using the instances.image.bytesBase64Encoded format instead, I get this error.
-
Binary data issue on n8n Cloud — Since n8n Cloud uses binaryDataMode: filesystem, the Code node’s JS sandbox only gets a short file reference (~13 chars) in binary.data instead of actual base64. I worked around this by adding a Set node with expression {{ $binary.edited.data }} to extract the real base64 into a JSON field before the Code node reads it. The base64 data now appears to be the correct length, but the Veo API still rejects it.
My setup:
- n8n version: 1.123.22 (Cloud)
- Auth: x-goog-api-key header
- Image source: output of Gemini gemini-3-pro-image-preview image edit node (binary property “edited”, PNG format)
What I’ve tried:
- Stripping data URI prefixes from base64
- Validating base64 length (it’s substantial, not empty)
- Both bytesBase64Encoded (in instances) and inlineData (in referenceImages) formats
- Ensuring mimeType is image/png
Questions:
- Has anyone successfully sent a Gemini-generated image to Veo 3.1 for image-to-video in n8n?
- Is there a specific image format/size requirement for Veo 3.1 image-to-video?
- Could the issue be that the base64 from n8n’s expression engine includes padding or encoding artifacts that Veo doesn’t accept?
- Is veo-3.1-generate-preview the correct model ID for image-to-video, or is there a different endpoint?
Any help is greatly appreciated!