flow-agent

kodelyx活跃维护

封装 Google Flow 的 CLI 工具,用命令行批量生成 Nano Banana Pro 图片和 Omni Flash 视频,并支持 MCP v2 与 OpenAI API 接入。

⚡ CLI toolkit for Google Flow — Nano Banana Pro images, Omni Flash videos, MCP v2 & OpenAI API.

v1.0.0发布于 2026-09-25 05:36 UTC257star81fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
cd flow-agent
python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[test]'
./bin/flow bridge
硬件要求按 README 说明

README 未说明显存或 GPU 要求;需 Python 3.10+,并需在 Chrome 中安装 Flow 扩展、保持 Flow 页面在前台打开

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

本地 CLI 与 REST 服务,把 Google Flow 的图像视频生成能力接到脚本和 AI 助手里

封装 Google Flow 的 CLI 工具,用命令行批量生成 Nano Banana Pro 图片和 Omni Flash 视频,并支持 MCP v2 与 OpenAI API 接入。

核心能力

  • 提供 CLI、REST API、MCP 三种调用方式
  • 支持文生图,可选 5 种宽高比、一次最多 4 张
  • 支持文生视频与图生视频,时长 4~10 秒
  • 兼容 OpenAI SDK,只改 base_url 即可替换
  • 多 Google 账号池化额度,生成记录存本地 SQLite

容易踩的坑

必须先手动从 flow-extension/ 目录以「加载已解压的扩展程序」方式安装 Chrome 扩展,否则无法保存登录会话;需另开终端常驻运行 ./bin/flow bridge,并保持 labs.google/fx/tools/flow 标签页在前台,否则报 400 或异常活动;同时只保留一个 Chrome 配置和一个 Flow 标签页,多账号并行会冲突

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v1.0.0
  1. v1.0.0⚡ Flow Agent v1.0.0 — First Stable Release最新正式版2026-09-25 · 2026-09-25 05:36 UTC

    ⚡ Flow Agent v1.0.0

    Generate AI images and videos from Google Flow — via CLI, REST API, or your AI assistant.


    🆕 What's in this release

    🖼️ Image Generation

    • Text-to-image with 3 models: narwhal, harbor_seal, gem_pix_2
    • Aspect ratios: 1:1 16:9 9:16 4:3 3:4 square landscape portrait
    • Up to 4 variations per generation
    • Multi-account support (pool credits across Google accounts)

    🎬 Video Generation

    • Text-to-video: 4s 6s 8s 10s clips at 360p / 720p
    • Image-to-video animation (animate any photo)
    • Video upload to Flow project storage (with content-hash cache)

    🌐 REST API Server

    • Native endpoints: POST /api/v1/image, POST /api/v1/video, GET /api/v1/balance, etc.
    • OpenAI-compatible: POST /v1/images/generations, POST /v1/chat/completions (+ SSE)
    • Route aliases: every /api/v1/* also reachable via /v1/*
    • Interactive docs at http://127.0.0.1:8001/docs

    🤖 MCP Server

    • 5 tools: flow_generate_image, flow_generate_video, flow_get_balance, flow_get_stats, flow_get_projects
    • Works with Claude Desktop, Cursor, AGY, and any MCP-compatible client
    • Stdio and SSE transport support

    🔧 Engine Binaries (Cross-platform)

    PlatformBinary
    macOS (Apple Silicon + Intel)bin/flow-macos
    Linuxbin/flow-linux
    Windowsbin/flow-windows.exe

    Auto-detected by platform — no config needed.

    📊 Data & History

    • SQLite-backed generation history (data/flow.db)
    • Credit tracking per account
    • stats, balance, projects commands

    🚀 Quick Start

    # 1. Install
    pip install -e '.[test]'
    
    # 2. Check your setup
    ./bin/flow doctor
    
    # 3. Generate an image
    python main.py image "a glowing crystal lotus on calm water" --aspect 16:9
    
    # 4. Or start the API server
    python main.py server --port 8001
    

    ✅ Quality

    • 77 tests passing (CLI, REST API, MCP, SQLite, engine)
    • Full input validation — invalid args rejected with clear errors
    • All 5 reported defects (D1–D5) resolved

    📚 Documentation

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    ⚡ Flow Agent

    Generate AI images and videos from Google Flow — via CLI, REST API, or your AI assistant.

    Release Python FastAPI MCP Tests License

    "a glowing crystal lotus on calm water"  →  🖼️  output/acct-38e6.jpg  (26 s)
    "hyper-lapse sunrise over ocean horizon"  →  🎬  output/acct-video.mp4  (58 s)
    

    What does it do?

    Flow Agent is a local server and CLI that connects to Google Flow to generate high-quality AI images and videos. You set it up once, and then you can use it three ways:

    HowBest For
    🖥️ Terminal (CLI)Quick one-off generations, scripting
    🌐 REST APIConnecting any app — works exactly like OpenAI's API
    🤖 MCP ServerLetting Claude, Cursor, or AGY generate for you automatically

    Features at a Glance

    • 🖼️ Text → Image — aspect ratios: 1:1 16:9 9:16 4:3 3:4, up to 4 variations at once
    • 🎬 Text → Video — durations: 4s 6s 8s 10s, quality: 360p / 720p
    • 🎞️ Image → Video — animate any image into a video clip
    • 👥 Multi-Account — add multiple Google accounts to pool credits
    • 🔌 OpenAI Compatible — drop-in replacement: change base_url, nothing else
    • 📊 History & Stats — every generation logged to local SQLite with credits tracking
    • 🩺 Self-Diagnostics — ./bin/flow doctor tells you exactly what to fix

    Quick Start

    1 — Install

    cd flow-agent
    
    python3 -m venv .venv
    source .venv/bin/activate      # Windows: .venv\Scripts\activate
    
    pip install -e '.[test]'
    

    2 — Connect Your Google Account

    You need the Flow Chrome Extension installed in Chrome first.
    Load it from the flow-extension/ folder via chrome://extensions → Load unpacked.

    # Start the WebSocket bridge (keep this running in a terminal)
    ./bin/flow bridge
    

    Then open https://labs.google/fx/tools/flow in Chrome while signed in to your Google account. The extension will automatically save your session to cookies/.

    3 — Verify Setup

    ./bin/flow doctor
    

    You should see:

    ok    version     flow-go 0.1.0
    ok    database    data/flow.db
    ok    cookies     1 account(s) loaded
    ok    browser     extension attached
    

    4 — Generate Your First Image

    python main.py image "a glowing crystal lotus on calm water" --aspect 1:1
    
    ✓ saved output/acct-38e60406-67b.jpg  (26 s)
    

    Usage

    🖼️ Images

    # Basic — saves to output/
    python main.py image "PROMPT"
    
    # With options
    python main.py image "PROMPT" \
      --aspect 16:9          # 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | square | landscape | portrait
      --count 2              # 1–4 variations
      --model narwhal        # narwhal | harbor_seal | gem_pix_2
    
    # Run on all accounts at once (pools credits)
    python main.py image "PROMPT" --all
    

    🎬 Videos

    # Text to video
    python main.py video "PROMPT" \
      --aspect landscape     # landscape | portrait | 16:9 | 9:16
      --duration 8s          # 4s | 6s | 8s | 10s
      --quality 720p         # 360p | 720p
    
    # Image to video (animate a photo)
    python main.py video "camera slowly pans right" \
      --start-image output/my-image.jpg
    

    💰 Balance & Stats

    python main.py balance            # cached (instant)
    python main.py balance --refresh  # live probe from Google Flow
    
    python main.py stats              # generation history + credit usage
    python main.py projects           # list your Flow projects
    

    REST API Server

    python main.py server --port 8001
    

    Interactive docs open at http://127.0.0.1:8001/docs

    All Endpoints

    MethodPathDescription
    POST/api/v1/imageGenerate image
    POST/api/v1/videoGenerate video
    GET/api/v1/balanceCredit balance
    GET/api/v1/statsGeneration history
    GET/api/v1/projectsList Flow projects
    GET/api/v1/media/{file}Download result
    GET/healthServer liveness
    POST/v1/images/generationsOpenAI DALL-E compat
    POST/v1/chat/completionsOpenAI Chat compat + SSE

    Every /api/v1/* route also has a /v1/* alias — use whichever you prefer.

    Quick API Example

    curl -X POST http://127.0.0.1:8001/api/v1/image \
      -H "Content-Type: application/json" \
      -d '{"prompt": "neon cyber dragon over misty mountains", "aspect": "16:9"}'
    
    {
      "job_id": "ba884266-...",
      "status": "succeeded",
      "elapsed_seconds": 26.3,
      "files": [
        { "url": "http://127.0.0.1:8001/api/v1/media/acct-38e60406-67b.jpg" }
      ]
    }
    

    OpenAI SDK — Drop-in Replacement

    Change one line in your existing OpenAI code:

    from openai import OpenAI
    
    # ← Change only this line
    client = OpenAI(base_url="http://127.0.0.1:8001/v1", api_key="not-needed")
    
    # Everything else stays exactly the same ↓
    response = client.images.generate(
        prompt="a cute red origami fox sitting in autumn leaves",
        size="1792x1024",   # → Flow 16:9
        n=1
    )
    print(response.data[0].url)
    

    Supported OpenAI sizes → Flow mapping:

    sizeFlow aspect
    1024x1024 / square1:1
    1792x1024 / landscape16:9
    1024x1792 / portrait9:16
    1365x10244:3
    1024x13653:4

    MCP — Use With Claude / Cursor / AGY

    Flow Agent exposes 5 tools via the Model Context Protocol, so your AI assistant can generate images and videos directly for you.

    Setup (Claude Desktop)

    Add to claude_desktop_config.json:

    {
      "mcpServers": {
        "flow": {
          "command": "python3",
          "args": ["/absolute/path/to/flow-agent/main.py", "mcp"]
        }
      }
    }
    

    Setup (Cursor / AGY)

    {
      "flow": {
        "command": "python3",
        "args": ["/absolute/path/to/flow-agent/main.py", "mcp"]
      }
    }
    

    Available MCP Tools

    ToolWhat it does
    flow_generate_imageGenerate image from prompt
    flow_generate_videoGenerate video from prompt or image
    flow_get_balanceCheck credit balance
    flow_get_statsView generation history
    flow_get_projectsList Flow projects

    Now just ask your assistant: "Generate a 16:9 image of a cyberpunk city at dawn using Flow"


    Project Structure

    flow-agent/
    │
    ├── bin/
    │   ├── flow              → auto-selects the right binary
    │   ├── flow-macos        → macOS universal binary (arm64 + x86_64)
    │   ├── flow-linux        → Linux binary
    │   └── flow-windows.exe  → Windows binary
    │
    ├── cookies/
    │   └── account_<id>.json → saved Google account sessions
    │
    ├── data/
    │   └── flow.db           → SQLite: generation history + credits
    │
    ├── output/
    │   └── *.jpg, *.mp4      → your generated images and videos
    │
    ├── flow_agent/
    │   ├── api.py            → FastAPI REST server (Native + OpenAI routes)
    │   ├── engine.py         → subprocess bridge to bin/flow
    │   └── mcp_server.py     → MCP JSON-RPC server
    │
    ├── docs/                 → detailed reference docs
    ├── tests/                → 77 passing tests
    ├── main.py               → CLI entrypoint
    └── pyproject.toml
    

    Environment Variables

    VariableDefaultDescription
    IMAGE_MODELnarwhalDefault image model (narwhal / harbor_seal / gem_pix_2)
    FLOW_COOKIES_DIRcookies/Directory with account JSON files
    FLOW_OUTPUT_DIRoutput/Where generated files are saved
    FLOW_DB_PATHdata/flow.dbSQLite history database path

    Troubleshooting

    ProblemFix
    400 Bad Request / unusual activityBrowser tab at labs.google/fx/tools/flow must be open and in foreground with extension active
    0 projects in logsThe account's project_id field is empty — open Flow in Chrome to auto-populate it
    no extension attachedInstall the extension, run ./bin/flow bridge, open Flow tab in Chrome
    Two accounts conflictingClose all extra Chrome profiles — only keep one Flow tab open at a time
    pytest fails with PermissionErrorRun with --basetemp=/tmp/fa_test to use a writable temp directory

    Run Tests

    python3 -m pytest -q --basetemp=/tmp/fa_test
    
    77 passed in 0.38s
    

    Documentation

    DocDescription
    📘 API ReferenceEvery endpoint, parameter, and response schema
    ⌨️ CLI ReferenceAll commands, flags, env vars, exit codes
    🤖 MCP GuideClaude, Cursor, Zed, AGY setup
    🏗️ ArchitectureHow the engine, bridge, and server fit together
    🔌 Extension BridgeChrome extension + WebSocket protocol

    License

    MIT — free to use, modify, and distribute.