Empowering AI with seamless integration
简体中文 | English
Convert Gemini Business to OpenAI-compatible API with multi-account load balancing, image generation, video generation, multimodal capabilities, and built-in admin panel.
License: MIT License - See LICENSE for details
This tool is strictly prohibited for:
- Commercial use or profit-making activities
- Batch operations or automated abuse of any scale
- Market disruption or malicious competition
- Violations of Google's Terms of Service
- Violations of Microsoft's Terms of Service
Consequences of Abuse: Violations may result in permanent account suspension, legal liability, and all consequences are the sole responsibility of the user.
Legitimate Use Only: This project is intended solely for personal learning, technical research, and non-commercial educational purposes.
📖 Full Disclaimer: DISCLAIMER_EN.md
- ✅ Full OpenAI API compatibility - Seamless integration with existing tools
- ✅ Multi-account load balancing - Round-robin with automatic failover
- ✅ Automated account management - Auto registration and login with DuckMail and Microsoft email integration, supports headless browser mode
- ✅ Streaming output - Real-time responses
- ✅ Multimodal input - 100+ file types (images, PDF, Office docs, audio, video, code, etc.)
- ✅ Image generation & image-to-image - Configurable models, Base64 or URL output
- ✅ Video generation - Dedicated model with HTML/URL/Markdown output formats
- ✅ Smart file handling - Auto file type detection, supports URL and Base64
- ✅ Logging & monitoring - Real-time status and statistics
- ✅ Proxy support - Configure in the admin settings
- ✅ Built-in admin panel - Online configuration and account management
- ✅ Optional PostgreSQL backend — persists accounts/settings/stats thanks PR
| 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-pro-preview |
✅ | ✅ | ✅ | Optional | - |
gemini-imagen |
✅ | ✅ | ✅ | ✅ | - |
gemini-veo |
✅ | ✅ | ✅ | - | ✅ |
Virtual Models:
gemini-imagen: Dedicated image generation model with forced image generation capabilitygemini-veo: Dedicated video generation model with forced video generation capability
Thanks to PR #37 for Linux and Docker deployment optimizations.
Click the Fork button in the top-right corner to copy this project to your GitHub account.
- Log in to Zeabur and create a new project
- Click Create Project → Shared Cluster / Silicon Valley, United States → Create Project → Deploy New Service → Connect GitHub (authorize if prompted) → Select your forked repository → Deploy
- Click on the service card → Variables tab, and add the following environment variables:
| Variable | Required | Description |
|---|---|---|
ADMIN_KEY |
✅ | Admin panel login key (set your own) |
DATABASE_URL |
Recommended | PostgreSQL connection string (see "Database Persistence" below) |
💡 Strongly recommended to configure DATABASE_URL, otherwise data will be lost when Zeabur restarts. Get a free database at neon.tech
- Click Redeploy to apply the environment variables
- Wait for the build to complete (~1-2 minutes)
When this project is updated:
- Go to your forked GitHub repository
- Click Sync fork → Update branch
- Zeabur will automatically detect changes and redeploy
Linux/macOS:
git clone https://github.com/Dreamy-rain/gemini-business2api.git
cd gemini-business2api
bash setup.sh
cp .env.example .env
# Edit .env to set ADMIN_KEY
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate.bat # Windows
python main.py
# Run with pm2 in background
# Make sure you're in the project directory
pm2 start main.py --name gemini-api --interpreter ./.venv/bin/python3Windows:
git clone https://github.com/Dreamy-rain/gemini-business2api.git
cd gemini-business2api
setup.bat
copy .env.example .env
# Edit .env to set ADMIN_KEY
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate.bat # Windows
python main.py
# Run with pm2 in background
# Make sure you're in the project directory
pm2 start main.py --name gemini-api --interpreter ./.venv/bin/python3Script Features:
- ✅ Automatically syncs latest code
- ✅ Updates frontend to latest versions
- ✅ Creates/updates Python virtual environment
- ✅ Installs/updates dependencies
- ✅ Automatically creates
.envconfig file (if not exists)
First Installation: After completion, edit .env to set ADMIN_KEY, then run python main.py
Update Project: Simply run the same command, the script will automatically update all components (code, dependencies, frontend)
git clone https://github.com/Dreamy-rain/gemini-business2api.git
cd gemini-business2api
# Build frontend
cd frontend
npm install
npm run build
cd ..
# Create virtual environment (recommended)
python3 -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate.bat # Windows
# Install Python dependencies
pip install -r requirements.txt
cp .env.example .env
# win copy .env.example .env
# Edit .env to set ADMIN_KEY
python main.py
# Run with pm2 in background
# Make sure you're in the project directory
pm2 start main.py --name gemini-api --interpreter ./.venv/bin/python3Supports ARM64 and AMD64 architectures
# 1. Clone the repository
git clone https://github.com/Dreamy-rain/gemini-business2api.git
cd gemini-business2api
# 2. Configure environment variables
cp .env.example .env
# Edit .env to set ADMIN_KEY
# 3. Start the service
docker-compose up -d
# 4. View logs
docker-compose logs -f
# 5. Update to the latest version
docker-compose pull && docker-compose up -dThanks to PR #9 for optimizing the Dockerfile build
Configure a PostgreSQL database to persist accounts, settings, and statistics across restarts.
- Set
DATABASE_URL=postgresql://user:password@host/dbname?sslmode=require- Local deployment: Add to
.envfile - Zeabur deployment: Add in the Variables tab
- Local deployment: Add to
- Keep the connection string secret (contains credentials)
# Get DATABASE_URL from Neon (Free)
1. Go to https://neon.tech and sign in
2. Create project -> Select a region
3. Open the project page, copy the Connection string
4. Example:
postgresql://user:password@ep-xxx.neon.tech/dbname?sslmode=require
If you have old local files (accounts.json/settings.yaml/stats.json), run the migration script:
# Run migration script directly
python scripts/migrate_to_database.py
# Zeabur environment: Click service → Command → Enter the following
python scripts/migrate_to_database.pyMigration script auto-detects:
- ✅
DATABASE_URLconfigured → Migrate to PostgreSQL (remote database) - ✅
DATABASE_URLnot configured → Migrate to SQLite (local data.db)
Migration content:
- ✅ Migrate from kv_store (old table structure) to new tables (PostgreSQL only)
- ✅ Migrate from local files (accounts.json/settings.yaml/stats.json) to database
- ✅ Auto-rename local files after migration (prevent duplicates)
- ✅ Preserve kv_store as backup (PostgreSQL only)
Note: SQLite and PostgreSQL table structures are fully compatible, future migration from SQLite → PostgreSQL is possible
- Admin Panel:
http://localhost:7860/(Login withADMIN_KEY) - OpenAI-compatible API:
http://localhost:7860/v1/chat/completions
- Account config prioritizes
ACCOUNTS_CONFIGenv var, or can be entered in admin panel and saved todata/accounts.json. - For authentication, configure
API_KEYin the admin settings to protect/v1/chat/completions.
- Supported file types: SUPPORTED_FILE_TYPES.md
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
If this project helps you, please give it a ⭐ Star!









