Generates images in Google Flow (labs.google/fx) through browser UI automation. Supports Nano Banana 2 and Nano Banana Pro with landscape/portrait aspect ratios. Use when the user requests Flow-based image generation.
Before running any generation command, complete the Pre-flight Checks below.
bash
# Default generation: creates a NEW Flow project through the UI
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat"
# Specify model + portrait + 2 images
${BUN_X} {baseDir}/scripts/main.ts --prompt "A sunset" --model NANO_BANANA_PRO --aspect 9:16 --count 2
# Reuse an EXISTING Flow project only when you already have the project id
${BUN_X} {baseDir}/scripts/main.ts --project-id <project-id> --prompt "A sunset"
# Authentication only
${BUN_X} {baseDir}/scripts/main.ts --login
# Batch mode: multiple prompts in one project (5s interval)
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat" --prompt "A sunset" --prompt "A mountain landscape"
Batch mode rules:
Use one command with repeated --prompt
The first prompt creates a new project through the UI unless --project-id is supplied
Later prompts reuse that same project
Do not run multiple separate main.ts commands for a multi-prompt batch
Pre-flight Checks
Run these checks in order. Each step must pass before moving to the next.
Then wait for the user to finish Google login in the browser.
Generation Rules
The skill supports exactly two generation entry modes:
New project: omit --project-id; the script creates a project through the Flow UI
Existing project: provide --project-id
Do not invent any third path.
Explicitly forbidden:
API-based project creation
Describing API project creation as a fallback
Mixing one failed path with a different project-creation mechanism mid-run
If automatic UI project creation fails:
Inspect the Flow listing page in the browser
Fix the UI state only
Retry the same UI path
If needed, manually click 新建项目 in the browser, capture the resulting project id from the URL, then rerun main.ts with --project-id <id>
The fallback is still UI-only.
Task Completion (IMPORTANT)
main.ts only automates the UI. It fills the prompt, clicks Create, then exits immediately. Actual image generation continues asynchronously in the browser.
After main.ts exits with code 0:
The script has successfully submitted all prompts. Images are now generating in the browser.
You MUST verify generation completion by taking a browser screenshot (via CDP or screenshot tool) and visually checking whether images have appeared on the page.
If the screenshot shows images are still loading (spinner, progress indicator, blank placeholders), wait 10-15 seconds and take another screenshot.
Repeat until all images are visible, or until 2 minutes have passed (then report a timeout).
Once the base images are confirmed visible, stop and report completion.
Do NOT download, fetch, curl, or render any URLs. Images are visible in the browser.
Important completion rule:
If the images are visible and Flow still shows optional HD-enhancement / download / post-processing toasts, treat the task as complete anyway.
If the script exits with a non-zero code, report the error and stop.
Options
Option
Description
--prompt, -p
Prompt text (repeat for batch mode)
--model, -m
Model ID (see Models table)
--aspect, -a
Aspect ratio: 16:9 (default), 9:16
--count
Number of images: 1-4 (default: 2)
--project-id
Reuse existing project
--verbose
Enable debug logging
--login
Authenticate and save cookies, then exit
--cookie-path
Custom cookie file path
--profile-dir
Chrome profile directory
Models
Model
Description
NARWHAL
Nano Banana 2 (default, fast)
NANO_BANANA_PRO
Nano Banana Pro
Optional Verification Helper
If /home/admin1/.openclaw/workspace/scripts/agent-browser-cdp.sh exists, it is a convenient helper for screenshots and browser inspection after generation: