✨Reverse-engineered API for Gemini web app. It can be used as a genuine API key from OpenAI, Gemini, and Claude.
翻訳待ち
開発ツールGo · DockerfileGitHub @ntthanh2603自分でインストール所有者未確認
Paste into Claude or ChatGPT for installation instructions suited to your environment.
Have you tried it? One tap is enough. No sign-in needed.
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗[!NOTE] This project is intended for research and educational purposes only. Please use responsibly and refrain from any commercial use.
[!WARNING] This project is not affiliated with Google. It uses reverse-engineered web cookies and may not comply with Google's Terms of Service. Use at your own risk — the author assumes no responsibility for any account actions or data loss.
Problem: You want to use Google Gemini's latest models, but you don't have an API key or prefer not to use one.
Solution: Creates a local API server that:
Use Cases:
No cloning needed — pull and run directly from the registry.
Step 1 — Get your cookies
[!WARNING] Keep these values secure and never share or commit them — they provide direct access to your Google account.
F12 → Network, reload Gemini, and select a
batchexecute?rpcids=otAQ7b requestCookie request header. If the request URL contains an
account slot such as /u/2/, also use GEMINI_AUTH_USER="2" below.Step 2 — Run
docker run -d -p 4981:4981 \
-e GEMINI_COOKIES="your_complete_cookie_header" \
-e GEMINI_AUTH_USER="2" \
-e GEMINI_REFRESH_INTERVAL=1440 \
-e GEMINI_MAX_RETRIES=3 \
-e GEMINI_TEMPORARY=false \
-e APP_ENV=production \
-e RATE_LIMIT_ENABLED=true \
-e RATE_LIMIT_WINDOW_MS=60000 \
-e RATE_LIMIT_MAX_REQUESTS=10 \
-v ./cookies:/home/appuser/.cookies \
--tmpfs /tmp:rw,size=512m \
--tmpfs /home/appuser/.cache:rw,size=256m \
--name gemini-web-to-api \
--restart unless-stopped \
ghcr.io/ntthanh2603/gemini-web-to-api:latest
Done! Jump to Test it. 🎉
Use this if you want to build for a specific architecture (amd64, arm64, etc.) or modify the source code.
Step 1 — Clone the repository
git clone https://github.com/ntthanh2603/gemini-web-to-api.git
cd gemini-web-to-api
Step 2 — Get your cookies and configure .env
[!WARNING] Keep these values secure and never commit your
.envfile — it contains credentials that provide access to your Google account.
Go to gemini.google.com and sign in
Press F12 → Network, reload Gemini, and select a
batchexecute?rpcids=otAQ7b request
Copy its complete Cookie request header into GEMINI_COOKIES.
Match GEMINI_AUTH_USER to the request URL. For example, use 2 when the
URL contains /u/2/; leave it empty when there is no /u/<number>/.
Always take the cookie and account slot from the same browser tab.
Create your .env from the example:
cp .env.example .env
Paste the values into .env:
GEMINI_COOKIES=your_complete_cookie_header
GEMINI_AUTH_USER=2
GEMINI_REFRESH_INTERVAL=1440
GEMINI_MAX_RETRIES=3
GEMINI_TEMPORARY=false
APP_ENV=production
RATE_LIMIT_ENABLED=true
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=10
Step 3 — Run
Pick whichever method suits your setup:
| Method | Command | Requirements |
|---|---|---|
| 🐳 Docker Compose | docker compose up -d --build | Docker |
| 🐹 Go direct | go run cmd/server/main.go | Go 1.21+ |
| ⚡ Task (dev mode) | task dev | Task + Air (task install-air) |
task devruns the server with hot reload: Air rebuilds and restarts it whenever a.go,.jsonor.envfile changes (config in.air.toml).
Done! Jump to Test it. 🎉
curl -X POST http://localhost:4981/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "gemini-auto", "messages": [{"role": "user", "content": "Hello!"}]}'
Your Gemini Web To API is running at http://localhost:4981 🎉
This is the beginning of the README. Read the rest at the original. Read the full README ↗