Professional image generation library and OpenAI-compatible API for Google Flow
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file google_flow-2.0.0.tar.gz.
File metadata
- Download URL: google_flow-2.0.0.tar.gz
- Upload date:
- Size: 224.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9603e9c7aa3b9ae5851027f651d74dc907c91be1ce35252f31247d47b59cfbb
|
|
| MD5 |
a3f1644e049b2762dd331c6a7168b79a
|
|
| BLAKE2b-256 |
7664f5177f80d18bfc12cf50b53150f39e5ad88d9294e217c2b2e0e0efafb215
|
Provenance
The following attestation bundles were made for google_flow-2.0.0.tar.gz:
Publisher:
publish.yml on 3mora2/google-flow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_flow-2.0.0.tar.gz -
Subject digest:
f9603e9c7aa3b9ae5851027f651d74dc907c91be1ce35252f31247d47b59cfbb - Sigstore transparency entry: 1839832871
- Sigstore integration time:
-
Permalink:
3mora2/google-flow@66c87b19ef3045119e9490e992883fe36f7d7220 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/3mora2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@66c87b19ef3045119e9490e992883fe36f7d7220 -
Trigger Event:
release
-
Statement type:
File details
Details for the file google_flow-2.0.0-py3-none-any.whl.
File metadata
- Download URL: google_flow-2.0.0-py3-none-any.whl
- Upload date:
- Size: 245.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
038dd9feecfb88197c91ca6f58ec29e3c581de219389a50b6c18328d0b15e18f
|
|
| MD5 |
89fada2935d97101326543042e4fce59
|
|
| BLAKE2b-256 |
6ac6a4ca12006692d93fbb2f0370f265662e6b3531b0d3c66b4f74d84316131f
|
Provenance
The following attestation bundles were made for google_flow-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on 3mora2/google-flow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_flow-2.0.0-py3-none-any.whl -
Subject digest:
038dd9feecfb88197c91ca6f58ec29e3c581de219389a50b6c18328d0b15e18f - Sigstore transparency entry: 1839832915
- Sigstore integration time:
-
Permalink:
3mora2/google-flow@66c87b19ef3045119e9490e992883fe36f7d7220 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/3mora2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@66c87b19ef3045119e9490e992883fe36f7d7220 -
Trigger Event:
release
-
Statement type: