I’m trying to build an automated image generation workflow in n8n using
Google Cloud (Vertex AI) with a service account. I am using the HTTP Request node to post from URL.
My goal is:
provide one or more reference images
provide a text prompt describing the scene
generate a single final image
I’m NOT looking for text-to-image only.
I specifically need image + image + prompt → new image.
I see many model names in Google documentation and AI Studio, but it’s unclear:
which Imagen model is actually usable via Vertex AI REST API
which one people use in real production workflows (img2img / image editing)
For image + image + prompt → new image on Vertex AI, the model you want is the Imagen model designed for editing/customization:
• Use imagen-3.0-capability-001 via the Vertex AI Imagen API. This model supports providing one or more reference images and a text prompt to guide generation or edit based on the input images.
Vertex AI also lets you generate or edit images using Imagen with masks or raw reference images, where you send the reference image bytes plus a prompt in the same API call.
If you only need text-to-image without a reference image, the general Imagen generation models (like imagen-3.0-generate-002) are available for that purpose, but they won’t take reference images in the same way. Although i won’t say “That model is the best” cause every model is trained differently i recommend trying out some models and based on the output you are desiring pick the one which meets your needs, let me know if this helps!
@Abstract-Creator Your error is because the API expects a different JSON structure and specific image fields. Vertex AI’s Generative Image models require referenceImages[i].referenceImage.image with both bytesBase64Encoded and mimeType. Just having referenceImage.bytesBase64Encoded is not enough.
Use referenceImage.image with mimeType
The API requires the image object to include "image": { "bytesBase64Encoded": ..., "mimeType": ... }. Just putting base64 at referenceImage level is not supported.
Valid referenceType
Use a supported enum such as "REFERENCE_TYPE_RAW" for raw reference images. Unsupported types can cause a 400.
Proper string injection
When injecting values from n8n expressions, use .toJsonString() so the JSON sent to the API is valid.
If you adjust your body to match the structure above, the API should stop returning 400 Invalid Argument and accept the request. Maybe this will bring some help to you