google-flow
Integrates with Google Flow, allowing AI agents to generate images using models like Nano Banana 2, Nano Banana Pro, and Imagen 3, as well as videos using Gemini Omni Flash 1.1.
Can be used within LangChain applications through the OpenAI-compatible REST API for generating images and videos.
Can integrate with n8n via the OpenAI-compatible server, allowing workflow automation to send image and video generation requests.
Provides an OpenAI-compatible REST API that emulates the image generations endpoint, allowing use with tools like n8n, Dify, and LangChain.
Provides a Python SDK (FlowClient, FlowEditor, FlowDownloader) for programmatic access to Google Flow's image and video generation, with support for batch carousel creation and character consistency.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@google-flow generate an image of a cyberpunk city at night"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🎨 flow-py: Google Flow for AI Agents (google-flow-api)
The Unofficial Multi-Agent Automation Engine, CLI, MCP Server & Universal Skill for Google Flow.
Offload production-grade image generation (Nano Banana 2, Nano Banana Pro, Imagen 3) and cinematic video generation (Gemini Omni Flash 1.1) to Google Flow directly from any AI Agent — with zero token waste and native original quality.
🤖 Multi-Agent Compatibility Matrix
google-flow-api is built from the ground up to integrate natively into every major AI coding and automation agent:
Agent / Harness | Integration Mechanism | Configuration File |
Claude Code (Anthropic) | Native CLI / | |
OpenAI Codex | Subprocess CLI / | |
OpenClaw | Autonomous Skill Runner | |
Hermes Agent (Nous Research) | CLI | |
OpenCode | Skill / MCP Stdio Server |
|
Google Antigravity | Native Workspace Skill |
|
Cursor / Windsurf / Claude Desktop | Model Context Protocol (MCP) |
|
Related MCP server: Google Flow Browser MCP
✨ Key Capabilities
🤫 Silent Background Engine (Headless-by-Default): Operates 100% invisibly in the background with zero window popups (parity with
/notebooklm). Chrome runs in--headless=newwith Full HD viewport and WebGL acceleration. Use--headwhenever you want visual inspection.⚡ Sub-Second Preflight Auth Check (
auth-check): Instantly verifies authenticated state and canvas readiness in sub-second JSON response without opening windows.🛑 Safe Lifecycle Control (
google-flow stop): Safely shuts down the background headless browser daemon and frees RAM/CPU, isolating port 9222 and never touching your personal browsing windows.🎯 Deterministic JSON Output (
--json): All automated commands output structured JSON tostdoutwith predictable exit codes (0for success,1for error).👤 Multi-Reference Character Consistency: Pass reference images (front, side, profile) to maintain character facial identity across different scenes.
🎬 Native Video Support (Gemini Omni Flash 1.1): Text-to-Video and Image-to-Video with strictly validated durations (
4s,6s,8s,10s) and native 720p MP4 download.🔄 Concurrent Batch & Carousels (
batch): Dispatches multi-slide prompts with a 3-second interval, generating 8-10 slides in parallel in ~1 minute.🔌 OpenAI-Compatible REST API (
google-flow serve): Local FastAPI endpoint emulatingPOST /v1/images/generationsfor n8n, Dify, LangChain, or custom applications.💎 Dual-Detection Asset Downloader: Extracts full 1K/2K resolution images directly from the WebGL canvas and network responses.
📦 Installation & Quickstart
Prerequisites
Python 3.10+
Google Chrome installed locally
uv(recommended) orpip
# Clone repository
git clone https://github.com/twofxz/flow-py.git
cd flow-py
# Install dependencies and dev tools
uv sync --extra dev🔐 One-Time Authentication
Authenticate your Google account once in a dedicated, isolated browser profile:
uv run google-flow loginA Chrome window opens at
https://flow.google.com.Sign into your Google account and accept terms of service if visiting for the first time.
Press
[ENTER]in the terminal when you see the Flow canvas.Your authenticated session is permanently stored in
~/.google-flow/chrome_profile/with restricted permissions (0600).
Verify Authentication State
uv run google-flow auth-check --json{
"authenticated": true,
"status": "ready",
"url": "https://flow.google.com/project/01caca8b-...",
"session": "default",
"profile_dir": "C:\\Users\\...\\.google-flow\\chrome_profile"
}💻 CLI Commands & Recipes
1. Text-to-Image (T2I)
uv run google-flow generate \
--prompt "Cinematic photo of an astronaut discovering ancient ruins on Mars, volumetric light, 8k" \
--model "Nano Banana 2" \
--ratio "16:9" \
--resolution "1K" \
--output-dir "./output" \
--filename "mars_ruins.jpeg"2. Image-to-Image & Character Consistency (I2I)
uv run google-flow generate \
--prompt "The character in casual clothing having a coffee in a vibrant Parisian cafe" \
--reference "./assets/character_face.jpeg" \
--model "Nano Banana 2" \
--ratio "9:16" \
--output-dir "./output" \
--filename "character_paris.jpeg"3. Video Generation (Gemini Omni Flash 1.1)
# Text-to-Video (T2V) - 6 seconds
uv run google-flow video \
--prompt "Cinematic aerial tracking shot orbiting a lighthouse during a storm, rough waves crashing" \
--duration 6 \
--ratio "16:9" \
--output-dir "./output" \
--filename "stormy_lighthouse.mp4"
# Image-to-Video (I2V) - 4 seconds
uv run google-flow video \
--prompt "The character smiles gently and turns their head towards the camera" \
--reference "./output/mars_ruins.jpeg" \
--duration 4 \
--ratio "16:9" \
--output-dir "./output"4. Batch Carousel Generation (Instagram / LinkedIn)
uv run google-flow batch \
--manifest "./carousel_prompts.json" \
--reference "./assets/spokesperson.jpeg" \
--ratio "3:4" \
--delay 3.0 \
--output-dir "./output/carousel"🔌 Model Context Protocol (MCP) Setup
Connect Google Flow directly to Claude Desktop, Cursor, OpenCode, or Windsurf:
uv run google-flow mcpConfiguration (claude_desktop_config.json):
{
"mcpServers": {
"google-flow": {
"command": "uv",
"args": ["run", "--directory", "/path/to/google-flow-api", "google-flow", "mcp"]
}
}
}🐍 Python SDK Usage
from flow_api import FlowClient, FlowEditor, FlowDownloader
client = FlowClient(download_dir="./output_images", headless=True)
try:
client.start_browser_if_needed()
page = client.connect()
client.ensure_canvas()
editor = FlowEditor(page)
editor.submit_prompt(
prompt="Cyberpunk flying taxi soaring between holographic skyscrapers, heavy rain",
model="Nano Banana 2",
aspect_ratio="16:9"
)
editor.wait_for_generation(timeout=90)
downloader = FlowDownloader(page, client.download_dir)
saved_path = downloader.download_current(resolution="1K")
print(f"✅ Image saved: {saved_path}")
finally:
client.close()🌐 OpenAI-Compatible Server (for n8n, Dify, LangChain)
uv run google-flow serve --port 8000Send standard OpenAI image generation requests:
curl http://localhost:8000/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "Futuristic electric supercar on a scenic coastal highway at sunset",
"size": "1792x1024"
}'🧪 Testing
Run the automated test suite:
uv run pytest🛡️ Security & Privacy
google-flow-api strictly isolates credentials in ~/.google-flow/ and contains zero telemetry or third-party relays. For detailed security guidelines, threat modeling, and CI/CD best practices, please read SECURITY.md.
📄 License
MIT License - Copyright (c) 2026 Gabriel Siqueira.
Disclaimer: This is an independent open-source automation engine for research and automation purposes. It is not affiliated with, endorsed by, or sponsored by Google.
Available Tools
3 toolsflow_statusA
Verifica o status da conexão com o Google Flow, autenticação da conta e projeto ativo.
Inputs: no named parameters. Returns: result
generate_imageA
Gera uma imagem cinematográfica de alta qualidade no Google Flow e salva localmente em resolução nativa original (1K/2K).
Args: prompt: Descrição visual detalhada da cena. ratio: Proporção da imagem ('16:9', '9:16', '1:1', '3:4', '4:3'). model: Modelo ('Nano Banana 2' ou 'Nano Banana Pro'). reference_image: Caminho local de imagem de referência para consistência de personagem/estilo. resolution: Resolução nativa ('1K' ou '2K').
Inputs: prompt (required), model, ratio, resolution, +1 more. Returns: result
generate_videoA
Gera um vídeo nativo MP4 no Google Flow usando Gemini Omni Flash 1.1 (Text-to-Video ou Image-to-Video).
Args: prompt: Direção de cena e movimento de câmera do vídeo. duration: Duração OBRIGATÓRIA em segundos. O Google Flow aceita exclusivamente: 4, 6, 8 ou 10. ratio: Proporção do vídeo ('16:9' widescreen ou '9:16' vertical Reels/Stories). reference_image: Caminho local de imagem base para geração Image-to-Video (I2V).
Inputs: prompt (required), ratio, duration, reference_image. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
flow_status is clearly a connection/auth check, while generate_image and generate_video are distinct media generation operations with no overlap in intent. An agent can confidently separate status verification from content creation.
generate_image and generate_video follow a consistent verb_noun pattern, but flow_status breaks the convention by leading with the noun and using a different style. The mixed pattern is readable but not fully uniform.
At 3 tools, the surface is small but appropriately scoped for a focused media generation server. Each tool serves a distinct purpose and there is no bloat, though the set could slightly expand to cover more workflow steps.
The core generation capabilities for images and videos are present, and the status check covers connection state. However, there are notable gaps: no way to list, retrieve, cancel, or manage generation jobs/results beyond local saving.
Maintenance
Related MCP Connectors
Google Flow's agent: chat that plans and makes images and videos, approvals, your own media
AI video, image and audio generation with 140+ AI models from any MCP agent
Create images & video from any MCP agent — 17 models, spend limits, one URL.
AI image, video, voice and music generation over MCP, routed to Veo 3.1, Seedance 2.5 and more.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server that lets AI agents control Google Flow for generating images and videos using the user's own Google account. It provides tools for image generation, video creation, character and scene management, and UI discovery.171MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents to control Google Flow for image and video generation using your own Google account.1-
- AlicenseCqualityBmaintenanceEnables AI agents to orchestrate Google Flow video and image generation, including multi-scene planning, silent background generation, credit tracking, and video stitching via MCP.25MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents from an MCP client to control Google Flow through a signed-in Chrome session, generating videos and images with Veo, Nano Banana, and Omni while managing projects, assets, scenes, characters, and shot lists with spending-approval guards and a sandboxed file vault.5MIT