An elegant, production-ready OpenAI-compatible proxy for Google Gemini's Web Interface.
Built for developers who value performance, stability, and clean architecture.
⚡ OpenAI Compatible • 🚀 Production Ready • 🛡 Secure by Default • 🤖 Gemini Advanced
Gemini OpenAI Proxy bridges the gap between your applications and Google Gemini's powerful web models by exposing a fully OpenAI-compatible API.
Simply replace your existing OpenAI endpoint with Gemini Proxy and continue using your favorite SDKs (like AutoGen, LobeChat, Chatbox, or AnythingLLM) without changing your application logic.
Enjoy access to gemini-3-pro, gemini-3-flash, and their multimodal capabilities — all through standard OpenAI formats.
|
Works with existing OpenAI SDKs. No client-side rewrites. Drop-in replacement. |
Docker / Non-root support API Key Authentication No Data Logging Cookie-based Auth |
Asynchronous Core (FastAPI) Thread-safe Sessions Automatic Cookie Refresh Cross-platform Launcher |
- ✅ Fully OpenAI-compatible API (Chat Completions, Models, Image Generation)
- ⚡ Multimodal Support — Send images and files to Gemini seamlessly
- 🚀 Tool Calling / Function Calling support built-in
- 💧 Watermark Removal — Automatically removes Gemini watermarks from generated images
- 🛡 Collision-Free Sessions — UUID-based session management
- 🔄 Auto-Refreshing Cookies — Integrated webhook for browser extension sync
- 📦 Cross-Platform Launcher — Run in foreground, background, systemd, or Task Scheduler
- 🐳 Docker Support — Clean, secure containerized deployment
git clone https://github.com/TheOwlKun/gemini-openai-proxy.git
cd gemini-openai-proxypip install -r requirements.txtcp .env.example .env
Valid Google cookies are strictly required to interface with Gemini.
Visit https://gemini.google.com/ ➔ Open Developer Tools (F12)
Navigate to the Application / Storage tab ➔ Select Cookies ➔ Copy the values for __Secure-1PSID and __Secure-1PSIDTS and add them to your .env file.
The proxy comes with a powerful cross-platform launcher that works on Windows, Linux, and macOS.
# Interactive Menu
python launch.py
# Or start directly in background
python launch.py backgrounddocker-compose up -dfrom openai import OpenAI
client = OpenAI(
api_key="sk-your-secret-key", # Set in your .env as GEMINI_API_KEY
base_url="http://localhost:3000/v1"
)
# 1. Chat Completion
response = client.chat.completions.create(
model="gemini-3-pro",
messages=[{"role": "user", "content": "Explain quantum computing in one sentence."}]
)
print(response.choices[0].message.content)
# 2. Image Generation
image = client.images.generate(
model="gemini-3-flash-image",
prompt="A futuristic cyberpunk city at night",
n=1
)
print(image.data[0].url)curl http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-secret-key" \
-d '{
"model": "gemini-3-pro",
"messages": [{"role": "user", "content": "Hello!"}]
}'Unlike simple scripts, Gemini Proxy includes production-grade architecture by default:
- FastAPI & Uvicorn asynchronous core
- True Session Management (no more collision bugs with identical prompts)
- Robust XML Parser for Gemini's tool calls
- Background Service Wrappers (systemd for Linux, hidden process/Task Scheduler for Windows)
- Secure Docker Image (runs as non-root user)
Perfect for personal AI agents, internal tools, and LobeChat/AnythingLLM backends.
If this project saved you time or made your workflow easier, consider supporting future open-source development.
Crafted with ❤️ by @TheOwlKun
⭐ If you find this project useful, consider giving it a star!