Nodes/comfyui-stillfront/SF VertexAI Imagen 4 Text to Image
ComfyUI Node

SF VertexAI Imagen 4 Text to Image

Google's Imagen 4 straight into ComfyUI, billed to your GCP project

By razvanmatei-sf·Created 9 months ago·Updated 7 months ago· 0
SF VertexAI Imagen 4 Text to Image
    • images
    project_id
    locationus-central1
    prompt
    modelimagen-4.0-generate-001
    aspect_ratio1:1
    image_size1K
    num_images1
    seed2500633027
    safety_filter_levelBLOCK_MEDIUM_AND_ABOVE
    person_generationALLOW_ADULT
    enhance_promptfalse
    output_formatimage/png

    If you want Google's newest image model but don't want to leave ComfyUI, this node is the direct line. SF VertexAI Imagen 4 Text to Image sends your prompt to Imagen 4.0 through Google Cloud's Vertex AI and returns a real IMAGE tensor, so everything downstream - preview, upscale, VAE-free compositing, whatever - works exactly like a local generation. It's a pure text-to-image node; the sibling Imagen 4 Upscale covers enlargement, and if you want Google's edit model you'd reach for the Nano Banana nodes instead.

    How it works

    The node wraps the official google-genai SDK. On first run it builds a genai.Client(vertexai=True, project=..., location=...), which authenticates through Application Default Credentials - the same auth you set up once with the gcloud CLI. It then calls client.models.generate_images with your prompt, aspect ratio, and size, decodes the returned image bytes into a batch tensor, and hands it to ComfyUI. No API key goes in the node; your GCP project and billing do the work. That's the whole mental model: Vertex AI nodes = your cloud bill, local nodes = your GPU.

    The inputs that matter

    • project_id - your Google Cloud project ID. This is the one you actually have to look up; it's not "ComfyUI project."
    • location - us-central1 is the sensible default.
    • prompt - the generation prompt.
    • model - imagen-4.0-generate-001 by default, with fast/standard/ultra variants. The tooltip spells it out: fast = quick, standard = balanced, ultra = highest quality.
    • aspect_ratio and image_size - sizes are 1K and 2K, and 2K is only supported by the standard and ultra models. If you set 2K on fast, expect an error.
    • num_images - 1 to 4 per run.
    • seed - defaults to a random value each load; set it for reproducible runs.

    Worth knowing in the optional block: enhance_prompt (a prompt rewriter, preview feature), person_generation (default ALLOW_ADULT - this is a Google safety policy, not an on/off for anything spicy), and safety_filter_level (default BLOCK_MEDIUM_AND_ABOVE). These are the dials you touch when a perfectly reasonable prompt comes back blocked.

    Installing it

    It ships in the SF ComfyUI Nodes pack from Stillfront. ComfyUI Manager → "SF ComfyUI Nodes" → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Stillfront/comfyui-sf-nodes.git
    cd comfyui-sf-nodes
    pip install -r requirements.txt
    

    The pack's requirements.txt pulls in google-genai, which is the only heavy dependency this node needs. Beyond that, you need a Google Cloud project with the Vertex AI API enabled and billing turned on. Authenticate once:

    gcloud auth application-default login
    

    Common issues

    Two failure classes dominate. First, auth: "failed to locate Application Default Credentials" means you skipped gcloud auth application-default login or ran it in a different shell/user than ComfyUI. Second, money and quotas: no billing on the project, or a disabled Vertex AI API, and every call fails before it starts. And don't be surprised when a clean prompt gets refused - Google's filters are aggressive, which is exactly what the person_generation and safety_filter_level options exist to adjust. For a first run, leave everything at defaults, hit execute, and confirm you get a tensor back before you start tuning the cloud dials.

    CategoryStillfront/VertexAI

    Inputs (12)

    NameTypeDefaultDescription
    project_idSTRINGGoogle Cloud project ID
    locationSTRINGus-central1Google Cloud region (e.g., us-central1)
    promptSTRINGText description of the image to generate
    modelCOMBOimagen-4.0-generate-001Imagen 4.0 model variant (fast=quick, standard=balanced, ultra=highest quality)
    aspect_ratioCOMBO1:1Output image aspect ratio
    image_sizeCOMBO1KOutput resolution (2K only supported by standard and ultra models)
    num_imagesINT11–4Number of images to generate (1-4)
    seedINT25006330270–4294967295Random seed for reproducible results
    safety_filter_leveloptCOMBOBLOCK_MEDIUM_AND_ABOVESafety filter strictness level
    person_generationoptCOMBOALLOW_ADULTPerson generation policy
    enhance_promptoptBOOLEANfalseUse prompt rewriter to enhance the prompt (preview feature)
    output_formatoptCOMBOimage/pngOutput image format

    Outputs (1)

    NameTypeDescription
    imagesIMAGE