Flow Image Local API & Programmatic SDK (Unified)
Arabic Version: README-ar.md | Architecture Details: ARCHITECTURE-ar.md
This repository provides a unified local deployment of Google Flow image generation, exposed via an OpenAI-compatible HTTP API and a high-level programmatic Python SDK.
🌟 Key Features
- Guided Setup (
/setup): A user-friendly web interface that opens automatically, detects Google Flow login states, and synchronizes tokens without manual copy-pasting. - Integrated Token Updater: A background scheduling service that keeps session tokens alive across multiple profiles, supporting proxy isolation for each profile to prevent footprint leaks.
- In-Process Captcha Solver: Resolves reCAPTCHA challenges directly within the same Python process via Playwright/nodriver, eliminating separate bridge servers or port configurations.
- Programmatic SDK (
FlowSDK): A clean, thread-safe context manager to embed Google Flow image generation directly into other Python applications. - OpenAI-Compatible Endpoints: Seamlessly connects to any third-party AI UI client (e.g., Cherry Studio, Next Chat) using standard
URL,API Key, andModelconfigurations.
🚀 Quick Start
1. Installation
Double-click the installer:
install.bat
This will automatically create a .venv, install the package in editable mode, and download the Playwright Chromium browser.
2. Startup
Double-click the launcher:
start-flow-api.bat
This starts the API server on port 8787 and automatically opens the setup interface in your browser.
3. Complete Setup
- Log in to Google Flow on the browser window that opens.
- Wait for the setup page (
http://127.0.0.1:8787/setup) to detect the active session. - Copy the generated API URL, Key, and Model ID displayed on the screen.
📡 API Reference
Connection Details
- Base URL:
http://127.0.0.1:8787/v1 - Default API Key:
flow-local-key
Endpoints
POST /v1/images/generations- Text-to-Image generationPOST /v1/images/edits- Image-to-Image generation (watercolor, sketch, etc.)GET /v1/models- List available models and aspect ratiosGET /health- Health check statusGET /setup- Configuration wizard
🐍 Programmatic Python SDK Usage
You can import and use the SDK directly inside your own Python projects:
import asyncio
from google_flow import FlowSDK
async def main():
# Option 1: Direct Session Token Override
async with FlowSDK(st_token="your-session-token", project_id="your-project-id") as sdk:
image_path = await sdk.generate(
prompt="A futuristic city in antigravity, neon lights, 4k",
model="gemini-3.1-flash-image-landscape",
output_path="output/direct_t2i.png"
)
print(f"Image saved to: {image_path}")
# Option 2: Automatic Profile Selector (Querying local SQLite database)
async with FlowSDK() as sdk:
await sdk.select_profile("My_Google_Profile_Name")
image_path = await sdk.generate(
prompt="A majestic golden eagle flying over mountains",
model="gemini-3.1-flash-image-square",
output_path="output/profile_t2i.png"
)
print(f"Image saved to: {image_path}")
if __name__ == "__main__":
asyncio.run(main())
📁 Repository Structure
flow-image-cli-local-api/
├── google_flow/ # Unified core package
│ ├── api/ # FastAPI OpenAI web server & static dashboard
│ ├── captcha/ # In-process captcha provider integrations
│ ├── captcha_service/ # Integrated reCAPTCHA crawler (nodriver/playwright)
│ ├── token_updater/ # Automated session renewal daemon
│ ├── core/ # Programmatic SDK (FlowSDK) & API client
│ └── utils/ # Shared parsing, DB, and proxy utilities
├── examples/ # Programmatic usage examples
├── release-package/ # Scripts to build clean distribution zip packages
├── install.bat # One-click installer for Windows
├── start-flow-api.bat # One-click launcher for Windows
├── API_USAGE.md # API endpoints & cURL request examples
└── README.md
📦 Building a Release
To share a clean distribution folder (without .git, .venv, or local output folders) with friends or clients:
- Run
release-package\build-release-package.bat - Share the generated zip file located at
release-package\dist\flow-image-cli-local-api-v1.0.0.zip
📝 License
This project is licensed under the MIT License.
Metadata
Release files for google-flow 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| google_flow-2.0.0.tar.gz | 224.9 kB | With provenance | Details for google_flow-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| google_flow-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for google_flow-2.0.0-py3-none-any.whl |
Total release size: 470.2 kB
Release files / google_flow-2.0.0.tar.gz
| Download URL | google_flow-2.0.0.tar.gz |
|---|---|
| Size | 224.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9603e9c7aa3b9ae5851027f651d74dc907c91be1ce35252f31247d47b59cfbb
|
|
BLAKE2b-256 checksum How to use checksums |
7664f5177f80d18bfc12cf50b53150f39e5ad88d9294e217c2b2e0e0efafb215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.
Transparency logRelease files / google_flow-2.0.0-py3-none-any.whl
| Download URL | google_flow-2.0.0-py3-none-any.whl |
|---|---|
| Size | 245.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
038dd9feecfb88197c91ca6f58ec29e3c581de219389a50b6c18328d0b15e18f
|
|
BLAKE2b-256 checksum How to use checksums |
6ac6a4ca12006692d93fbb2f0370f265662e6b3531b0d3c66b4f74d84316131f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.
Transparency logSecurity for google-flow 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for google_flow-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.