Gemini Web2API - Netlify Deployment Documentation
中文文档 | Cloudflare Docs | Netlify Docs | Deno Docs Run Gemini Web2API on Netlify Edge Functions for SSE streaming and no server maintenance.Quick Deploy
Option 1: 1-Click Deploy to Netlify
- Click the Deploy to Netlify button above.
- Connect your GitHub account and choose a repository name.
- (Optional) In Environment Variables, configure
API_KEYorCOOKIE_STRING. - Click Deploy. Your API is live within a minute at
https://your-app-name.netlify.app.
Option 2: Connect via Netlify Dashboard (Git)
- Fork or push this repository to your GitHub account.
- Open the Netlify Dashboard.
- Click Add new site → Import an existing project.
- Select GitHub and authorize access to your repository.
- In the build settings:
- Base directory: (leave blank)
- Build command: (leave blank)
- Publish directory: (leave blank)
- Click Deploy site.
- Netlify will automatically detect
netlify.tomland configure the edge function at/*.
Environment Variables (Optional)
Configure these in Netlify: Site configuration → Environment variables → Add a variable.Proxy support on Netlify: Netlify Edge Functions do not provide raw TCP sockets (Deno.connect/cloudflare:sockets), so the rotating proxy pool (ENABLE_PROXY/PROXY_ENABLED) is not supported on Netlify and is ignored with aWARNin the logs. To route traffic through a proxy on Netlify, setHTTPS_PROXYinstead — this is the same native Deno tunneling the Deno Deploy deployment gets, and it works out of the box because Edge Functions run on Deno. Check/healthafter settingHTTPS_PROXY:proxy.modeshould flip fromdirecttooutboundandproxy.enabledtotrue(the proxy URL value itself is never reported). If it still saysdirect, the two usual causes are:Node.js runtime caveat: the above applies to Edge Functions (
- Scope: the environment variable’s scope must include Functions (Netlify Dashboard → Site configuration → Environment variables → the variable’s scope checkboxes), otherwise Edge Functions never see it at runtime.
- Redeploy: environment variables are injected at deploy time — trigger a redeploy after adding/changing
HTTPS_PROXY.netlify/edge-functions/, Deno). The classic Netlify Functions runtime (netlify/functions/, Node.js) does not auto-tunnelfetch()throughHTTPS_PROXY— on Node 18+ you’d need a custom dispatcher (e.g.undici.ProxyAgent). This repo’s Netlify deployment uses the Edge function at/*, soHTTPS_PROXYworks as described.
Tip for Multiple Cookies: You can rotate between multiple Google accounts by separating cookies with a pipe character (|), e.g.cookie_account_1| cookie_account_2.
Verification
Once deployed, check your health endpoint in your browser or with curl:proxy block reflects the actual outbound mode: direct (default), outbound (static HTTPS_PROXY in effect), or pool (rotating proxy pool — Cloudflare Workers and Deno Deploy only). Note that poolSupported is always false on Netlify Edge, so ENABLE_PROXY=true alone can never switch the mode to pool here; use HTTPS_PROXY to get "mode": "outbound" — that’s the supported way to proxy upstream traffic on Netlify.
Client Configuration
NextChat / ChatGPT-Next-Web
Cherry Studio / ChatBox
curl Test
Local Development
You can run and test the Netlify Edge Function locally using Netlify CLI:http://localhost:8888.
Troubleshooting
Error - Request ID: 01M...
That page is Netlify’s generic error response. It shows up when the edge function
crashes with an unhandled exception, or when it fails to send response headers
within Netlify’s 40-second limit. The real error is in the dashboard under
Logs → Edge Functions.
Known causes and fixes:
After any failure, the response body and the function logs now show the actual
error message, so you no longer have to guess behind
Error - Request ID.