Gemini Business → OpenAI-compatible API gateway
简体中文 | English
Current stable release: v0.3.2 | Release Notes | All Releases
Important
Since v0.3.0, the repository mainline has been fully narrowed into a 2API-focused mainline: only the 2API main service, the admin panel, and the optional refresh-worker remain.
The legacy registration tool, registration flow, built-in refresh executor, and browser-display-dependent old paths have been removed or moved out. If you need refresh capability, attach the standalone refresh-worker branch / image on demand.
Gemini Business2API turns Gemini Business into an OpenAI-compatible API gateway with a built-in admin panel for managing account pools, system settings, image / video capability, runtime monitoring, and logs.
The current mainline has a very clear goal: provide a stable 2API main service and keep historical registration, refresh, and experimental flows out of the primary repository path.
Join the Business2API group:
- OpenAI-compatible endpoints for common OpenAI SDKs and middleware
- Multi-account scheduling with rotation, availability switching, and batch management
- Admin panel for import / export / edit / batch actions / status filtering
- Multimodal support across text, files, images, and video-related flows
- Image generation / image editing with Base64 or URL output
- Video generation with unified output control
- Centralized settings for proxy, mail, refresh, and output behavior
- Dashboard / monitoring / logs / gallery for runtime visibility
- SQLite / PostgreSQL support
- Optional
refresh-workerintegration without tight coupling to the main service
| Model ID | Vision | Native Web | File Multimodal | Image Gen | Video Gen |
|---|---|---|---|---|---|
gemini-auto |
✅ | ✅ | ✅ | Optional | - |
gemini-2.5-flash |
✅ | ✅ | ✅ | Optional | - |
gemini-2.5-pro |
✅ | ✅ | ✅ | Optional | - |
gemini-3-flash-preview |
✅ | ✅ | ✅ | Optional | - |
gemini-3.1-pro-preview |
✅ | ✅ | ✅ | Optional | - |
gemini-imagen |
✅ | ✅ | ✅ | ✅ | - |
gemini-veo |
✅ | ✅ | ✅ | - | ✅ |
gemini-imagenis the dedicated image generation model, andgemini-veois the dedicated video generation model.
flowchart TB
Admin["Admin user"] --> Frontend["Admin panel frontend"]
Client["OpenAI-compatible client"] --> Gateway["2API gateway"]
subgraph Features["Admin feature modules"]
Dashboard["Overview"]
Accounts["Account management"]
Settings["System settings"]
Monitor["Monitoring"]
Logs["Runtime logs"]
Gallery["Image gallery"]
Docs["Docs / tutorials"]
end
Frontend --> Dashboard
Frontend --> Accounts
Frontend --> Settings
Frontend --> Monitor
Frontend --> Logs
Frontend --> Gallery
Frontend --> Docs
Dashboard --> AdminAPI["Admin APIs"]
Accounts --> AdminAPI
Settings --> AdminAPI
Monitor --> AdminAPI
Logs --> AdminAPI
Gallery --> AdminAPI
Docs --> AdminAPI
Gateway --> Runtime["Model / chat / image / video APIs"]
AdminAPI --> Domain["Account pool / config / scheduling / monitoring / logs"]
Runtime --> Domain
Domain --> DB["SQLite / PostgreSQL"]
Domain --> Data["data directory"]
Domain -. "optional integration" .-> Refresh["refresh-worker"]
Current mainline: the frontend focuses on 2API + admin management, while refresh is attached as an optional worker.
docker-compose.yml
├─ gemini-api
│ ├─ runs the 2API main service
│ ├─ runs the admin panel
│ ├─ exposes 7860
│ └─ mounts ./data:/app/data
│
└─ refresh-worker (optional)
├─ disabled by default
├─ enabled with profile refresh
├─ does not expose business APIs
├─ reads the same ./data volume
└─ handles account refresh work
- Mainline 2API only:
docker compose up -d - Attach refresh worker when needed:
docker compose --profile refresh up -d
git clone https://github.com/yukkcat/gemini-business2api.git
cd gemini-business2api
cp .env.example .env
# Set at least ADMIN_KEY
docker compose up -dEnable refresh-worker if needed:
docker compose --profile refresh up -dThe interactive installer is intended for guided command-line setup. During execution it prompts for the following configuration items:
- whether to use Docker deployment or local Python mode
- which service port to use
- the
ADMIN_KEY - the
DATABASE_URL - whether to enable refresh-worker
Default install:
curl -fsSL https://raw.githubusercontent.com/yukkcat/gemini-business2api/main/deploy/install.sh | sudo bashPin to the current stable release:
curl -fsSL https://raw.githubusercontent.com/yukkcat/gemini-business2api/v0.3.2/deploy/install.sh | sudo bashPreset refresh-worker to enabled by default:
curl -fsSL https://raw.githubusercontent.com/yukkcat/gemini-business2api/main/deploy/install.sh | sudo bash -s -- --with-refresh
--with-refreshonly presets the default answer for enabling refresh-worker. It does not represent a separate installation flow.
- Admin panel:
http://localhost:7860/ - OpenAI-compatible endpoint:
http://localhost:7860/v1/chat/completions - Health check:
http://localhost:7860/health
ADMIN_KEY=your-admin-login-key
# PORT=7860
# DATABASE_URL=postgresql://user:password@host:5432/dbname?sslmode=require
# REFRESH_WORKER_IMAGE=cooooookk/gemini-refresh-worker:latest
# REFRESH_HEALTH_PORT=8080Notes:
- the main service image comes from the mainline repository
REFRESH_WORKER_IMAGEpoints to the image built from the standalone refresh-worker branch- local SQLite is used by default when
DATABASE_URLis not set - PostgreSQL can be enabled by setting
DATABASE_URL
Compose mounts:
./data -> /app/data
This directory stores:
- the SQLite database
- runtime persistence data
- locally generated files and caches
| Endpoint | Method | Description |
|---|---|---|
/v1/models |
GET | model list |
/v1/chat/completions |
POST | chat completions |
/v1/images/generations |
POST | image generation |
/v1/images/edits |
POST | image editing |
/health |
GET | health check |
If you want one-click export of importable account JSON from Gemini Business pages, install the Tampermonkey userscript:
- Install URL: gemini-business-import.user.js
- Repository path:
tools/tampermonkey/gemini-business-import.user.js - Click
Copy JSONto copy;Shift + Clickto download a JSON file - Exported
expires_atdefaults to current time + 12 hours
Before use, make sure:
- Tampermonkey -> General -> Config mode:
Advanced - Tampermonkey -> Security -> Allow scripts to access cookies:
All - If cookie access is still blocked, enable Developer mode on the browser extensions page
- Refresh
business.gemini.googleand try again
The script will show a popup reminder when cookie access is unavailable.
This project uses the Cooperative Non-Commercial License (CNC-1.0).
If this project helps you, please give it a ⭐ Star!