Self-host gemini-web2api-go
v4.26.0OpenAI-compatible API proxy for Google Gemini web
- Stars
- 722
- Port
- 8083 (HTTP API and admin dashboard)
ghcr.io/zexadev/gemini-web2api-goWhat is gemini-web2api-go?
gemini-web2api-go reverse-proxies the Gemini web application (gemini.google.com) into an OpenAI-compatible REST API. It requires no Google API key and works with free Gemini accounts. The project is a single Go binary (or distroless Docker image) that implements Chrome 146 TLS fingerprinting, automatic cookie renewal, a proxy pool with per-IP rate limiting, and a Chinese-language admin dashboard for monitoring and configuration. It exposes /v1/chat/completions (streaming), /v1/models, /v1/responses, and /v1/videos for async video generation. An MCP server at /mcp provides a web_search tool for Claude Desktop and Cursor. Supported models include gemini-3.6-flash, gemini-3.5-flash-lite (anonymous), and gemini-3.1-pro, gemini-3.8-flash, gemini-4-argon with thinking variants when a valid cookie is provided. Image (gemini-image), music (gemini-music), canvas (gemini-canvas), and video (gemini-video) generation are supported. Data persists in SQLite by default, with optional MySQL/PostgreSQL via SQL_DSN. Deployment options: Docker (ghcr.io/zexadev/gemini-web2api-go), Docker Compose, direct binary download, or building from source. The admin UI at /admin manages proxy/cookie pools, API keys, and runtime settings without restart. Known limits: per-IP request caps (80–180 before Google blocks), context length ~130 KB (160 KB with cookie), prompt-level function calling, and Chrome-exported cookies may expire quickly due to device-bound sessions (Firefox recommended).
Should you self-host gemini-web2api-go?
gemini-web2api-go scores 56/100 on selfhost.directory (how scoring works) and ranks #14 of 39 in API Gateway. It has 722 GitHub stars.
It shipped 10 stable releases in the past year. The latest, v4.26.0, came out on 26 October 2026. New versions land roughly every 4 days.
Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is MIT-licensed and written mostly in Go.
Its closest alternative on selfhost.directory is Kong Gateway (82/100, 44 314 stars). It scores higher overall, so compare the two before you pick. See gemini-web2api-go vs Kong Gateway side by side.
Features
- Admin Dashboard
- Canvas generation
- Chrome TLS fingerprintingProxy connections use Go stdlib TLS fingerprint
- Cookie pool with auto-renewalFirefox-exported cookies recommended for long-term renewal
- Function calling (prompt-level)Model may not always return formatted tool calls; reliable for private data queries
- Image GenerationResolution locked to ~1MP by upstream
- MCP web_search tool
- Multiple Database BackendsAuto-migration, shared schema
- Multi-turn conversation supportDoes not expand model context window
- Music Generation
- OpenAI Compatible API
- Proxy pool with per-IP rate limiting
- Reasoning contentreasoning_tokens counted separately from completion_tokens
- Streaming ResponsesTools requests and /v1/responses are buffered
- Video GenerationFree accounts rejected by upstream content policy
gemini-web2api-go README
FAQ
Releases 里挑对应平台的下载,不用 Go、不用 Docker,单个文件就是全部
Pre-built binaries for 6 platforms available on GitHub Releases. No Go or Docker needed — single file is everything.
支持 MySQL / PostgreSQL 吗?
Yes. Set SQL_DSN env var (mysql://... or postgres://...). Defaults to SQLite. Auto-migration, shared schema across all three.
为什么在 Dify / 反向代理后面流式变成了一次性输出?
Regular chat is true streaming. Tools requests and /v1/responses are buffered. Response includes X-Accel-Buffering: no; check your reverse proxy's buffering settings.
生图用的是哪个模型?能出 2K 吗?
Uses whatever image backend the web UI currently uses (e.g., Nano Banana 2). Resolution locked to ~1 megapixel, no 2K output.
能用 Gemini 4 Argon 吗?怎么用?
Yes, model name gemini-4-argon (and -thinking, -thinking-medium). Requires a cookie from an account that has 4 Argon visible in gemini.google.com model selector (Google AI Pro/Ultra).
有 gemini-3.8-flash 吗?
Yes (gemini-3.8-flash and gemini-3.8-flash-thinking), requires paid Gemini account. Free accounts get downgraded to 3.5 Flash-Lite. gemini-3.7-flash kept as alias.
能当 Cursor / Dify / WorkBuddy 这类 agent 工具的后端吗?
Yes, OpenAI-compatible. Works for chat and coding. But context limit is ~130KB (160KB with cookie), so large agent prompts may hit limits. Function calling is prompt-level, not protocol-level.
为什么每发一条消息,gemini.google.com 里就多出一个会话?
Each request is an independent session by default. Enable 'multi_turn' in settings to reuse a conversation_id. Or enable 'temporary_chat' (recommended) to keep sessions out of the web UI entirely.
免费账号和 Pro / 付费账号差在哪?
Anonymous: gemini-3.6-flash, gemini-3.5-flash-lite with web search. Free account cookie adds: gemini-3.1-pro, thinking variants, vision, image/music/canvas. Paid adds: gemini-3.8-flash, gemini-4-argon, video generation.
会被封号吗?封禁是按账号还是按 IP?
Bans are by exit IP + TLS fingerprint, not by account. Burst requests (80-180) trigger blocks; slow pacing (10/min) can run 800+ requests unblocked. Paid accounts don't raise limits.
和 Sophomoresty/gemini-web2api(Python)、其它叫 gemini-web2api 的 Go 项目是什么关系?
Independent Go implementation. Early protocol research referenced the Python version's approach, but it's not a port. Other same-named Go projects are unrelated.
这和 Google 官方 Gemini API 有什么区别?需要 API Key 吗?
No API key needed. This project reverse-proxies the gemini.google.com web interface directly, not the official generativelanguage.googleapis.com API. So there's no API key or paid quota.
More in API Gateway
GeoServerSelf-hosted, open-source Java server that publishes and edits geospatial data through OGC standards such as WMS, WFS, WCS and WMTS, from Shapefile to PostGIS.
GetMCPGetMCP is a self-hosted Zero Trust proxy for AI agents that generates MCP servers from OpenAPI specs and enforces per-agent policies with tamper-evident audit logs.
GoModelThis open-source, self-hosted AI gateway in Go unifies 34 LLM providers behind OpenAI-style and Anthropic-style APIs, adding budgets, caching, routing and audit logs.
GPT-LoadAn open-source, self-hosted AI gateway routing one endpoint to 35 upstream channels — key credentials and subscription logins, with failover, logs and cost estimates.
graviteeSelf-hosted, open-source API management: gateway, 50+ policies, developer portal and analytics for REST, GraphQL and gRPC APIs, run via Docker Compose or Helm.
grokbuild-proxySelf-hosted proxy translating Anthropic and OpenAI API requests to Grok Build, letting you use your personal Grok account with Claude Code and compatible clients.
HarnessRouterSelf-hosted, open-source gateway running Codex, Claude Code and other agent harnesses behind one OpenAI Responses-compatible API with sessions, streaming and files.
inference-gatewaySelf-hosted gateway that routes requests to 16+ LLM providers through a single OpenAI-compatible endpoint with MCP tools, A2A agents, guardrails, and observability.
IsartorA self-hosted, open-source gateway that sits between AI coding assistants and LLM providers, using local caching and small models to eliminate most repeated cloud calls.
Jentic OneJentic One is a self-hosted, open-source execution layer letting AI agents securely call real APIs without handling credentials.
Kong GatewayKong is a self-hosted, open-source API and AI Gateway for proxying, routing, load balancing, auth, and LLM/MCP traffic with 60+ AI features.
krakendSelf-hosted, open-source API gateway: a single stateless binary that aggregates, secures and transforms microservice APIs, with Docker, deb/rpm and brew installs.
0 comments