ShawTim/gemini-app2api
حول
Zero-dependency native Gemini HTTP/2 gateway & in-process Pi extension (pi-gemini-app) connecting Gemini subscriptions to OpenAI-compatible coding agents (Codex, Pi, OpenCode) with multi-account pooling.
أدوات التطويرالنمو المقاس للنجوم
- خلال 24 ساعة
- +٤
- خلال 7 أيام
- +٣٦
- خلال 15 يومًا
- +١٣٨
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلGemini App2API
Your coding agents. Your Gemini subscriptions. Zero-dependency native HTTP/2.
Use your eligible Google Gemini accounts in Pi, OpenClaw, OpenCode, Claude Code, Cursor, Cline, Roo Code, Codex CLI, MCP clients, standalone Unix CLI, and OpenAI SDKs—via standalone in-process plugins/CLI (no server needed) or a self-hosted Node.js gateway with multi-account pooling and native POST /mcp.
English · 繁體中文 · 简体中文 · Quick Start · Connect Client · Models & Quota · API Reference · Operations
[!IMPORTANT] Unofficial interoperability research project. Not affiliated with or endorsed by Google. Sign in personally with your own eligible Google accounts—no credentials, tokens, or Google binaries are distributed. Read DISCLAIMER.md.
Quick Start
Path A — Standalone Native Plugins & CLI (No Server Required)

| Host | Install / Run | Sign In & Key Commands | Links & Guide |
|---|---|---|---|
| Pi / GooeyPi | pi install npm:pi-gemini-app |
/login gemini-app · /gemini-quota |
npm · Pi Packages · Guide |
| OpenClaw | openclaw plugins install openclaw-gemini-app (or npm:openclaw-gemini-app) |
openclaw models auth login --provider gemini-app · /usage |
npm · ClawHub · Guide |
| OpenCode | V2: opencode plugin add opencode-gemini-app (V1: "plugin": ["opencode-gemini-app"] in opencode.json) |
/connect (gemini-app) |
npm · Guide |
| Standalone MCP (stdio) | npx -y mcp-gemini-app |
npx -y mcp-gemini-app login · quota |
npm · Guide |
| Standalone CLI | npm i -g gemini-app-cli (or npx -y gemini-app-cli ask "...") |
gemini-app login · ask · search · --schema · --tools readonly |
npm · Guide · SKILL |
All 5 standalone packages run in-process over direct single-account Google OAuth HTTP/2 (no gateway server required; 15s PING keepalives, HTTPS_PROXY support, 256 tools, parallel multimodal image uploads, automatic Free-tier gemini-auto filtering). The standalone CLI (gemini-app-cli) is built for one-shot pipelines, CI, and bash-enabled coding agents—adding validated JSON Schema outputs (--schema), local file/image attachments (-f/-i), and an opt-in read-only workspace loop (--tools readonly with read/grep/find/ls, zero writes, zero shell execution).
Path B — Self-Hosted Multi-Account OpenAI-Compatible & MCP Gateway
Need multi-account pooling, automatic failover, sticky sessions, or an Admin console? Run the self-hosted gateway. Requires Node.js >= 22 (macOS / Linux / Windows / WSL2) or Docker Compose, plus one or more Google accounts with Gemini access (AI Studio API keys are a different service).
Node.js:
git clone https://github.com/ShawTim/gemini-app2api.git && cd gemini-app2api
npm ci --omit=dev --ignore-scripts
npm start
Docker Compose:
git clone https://github.com/ShawTim/gemini-app2api.git && cd gemini-app2api
read -r -s -p 'Admin password (>= 12 chars): ' GATEWAY_ADMIN_PASSWORD; echo
export GATEWAY_ADMIN_PASSWORD && docker compose up -d --build
Or run pre-built GHCR image directly (linux/amd64 & linux/arm64)
read -r -s -p 'Admin password (>= 12 chars): ' GATEWAY_ADMIN_PASSWORD; echo
docker run -d --name gemini-app2api --init --restart unless-stopped \
-p 127.0.0.1:18989:18989 -p 127.0.0.1:18765:18765 \
-v gemini-gateway-state:/data \
--read-only --cap-drop ALL --security-opt no-new-privileges \
--tmpfs /tmp:rw,noexec,nosuid,size=16m \
-e GATEWAY_HOST=0.0.0.0 -e GATEWAY_CALLBACK_HOST=0.0.0.0 -e GATEWAY_ALLOW_REMOTE=1 \
-e GATEWAY_PUBLIC_ORIGIN=http://127.0.0.1:18989 -e GATEWAY_ADMIN_PASSWORD \
ghcr.io/shawtim/gemini-app2api:latest
See Operations Guide for custom ports, TLS reverse proxies, and SSH tunneling.
Finish setup in browser: Open http://127.0.0.1:18989/admin/ → Accounts → + Google sign-in → click Test to verify entitlement → API keys → Create key.
Connect Your Client
| Setting | Value |
|---|---|
| Base URL | http://127.0.0.1:18989/v1 (or http://gateway:18989/v1 inside Compose / your HTTPS proxy URL) |
| MCP Endpoint | http://127.0.0.1:18989/mcp (Streamable HTTP; toggleable in Admin Settings; stdio bridge via bin/gemini-gateway mcp) |
| API Key | Client key from API keys (authenticates both /v1/* and /mcp) |
| Models | gemini-neon (flagship Pro; gemini-argon aliases here), gemini-carbon (Gemini 4 Carbon; Google AI Ultra accounts only), gemini-hydrogen (fast), gemini-flash-lite |
| Endpoints | GET /v1/models · POST /v1/chat/completions · POST /v1/responses · POST /mcp (full contract) |
curl -fsS http://127.0.0.1:18989/v1/chat/completions \
-H "Authorization: Bearer $GEMINI_GATEWAY_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-neon","messages":[{"role":"user","content":"Hello!"}]}'
Client Recipes — MCP (Claude Code / Cursor / Windsurf / VS Code), Codex CLI, Cline / Roo Code, Cherry Studio, OpenAI SDKs
- MCP Clients (Streamable HTTP — Claude Code, Cursor, Windsurf, Cline) — exposes
ask_gemini,gemini_search, andgemini_quotabacked by your gateway's multi-account pool (strict JSON, one-click copyable from Admin UI):{ "mcpServers": { "gemini-app": { "type": "http", "url": "http://127.0.0.1:18989/mcp", "headers": { "Authorization": "Bearer ${GEMINI_GATEWAY_KEY}" } } } }- VS Code (
.vscode/mcp.json): use top-level"servers"instead of"mcpServers"with"type": "http". - Codex CLI (
~/.codex/config.toml): use[mcp_servers.gemini_app]withurl = "http://127.0.0.1:18989/mcp"andbearer_token_env_var = "GEMINI_GATEWAY_KEY". - stdio-only MCP clients (e.g. Claude Desktop): invoke your local
node /path/to/gemini-app2api/bin/gemini-gateway mcpwithGEMINI_GATEWAY_URL+GEMINI_GATEWAY_API_KEY, or use standaloneextensions/mcp.
- VS Code (
- OpenAI Codex CLI (
~/.codex/config.toml) — native/v1/responses+ namespace tools:model = "gemini-hydrogen" # or "gemini-neon" model_provider = "gemini_app2api" model_reasoning_summary = "none" web_search = "disabled" [model_providers.gemini_app2api] name = "Gemini App2API" base_url = "http://127.0.0.1:18989/v1" env_key = "GEMINI_GATEWAY_KEY" wire_api = "responses" - Cline / Roo Code: API Provider
OpenAI Compatible, Base URLhttp://127.0.0.1:18989/v1, Modelgemini-hydrogenorgemini-neon. - Cursor: Settings → Models → add
gemini-neon/gemini-hydrogen→ Override OpenAI Base URL (HTTPS tunnel required if Cursor's cloud relay is active). - Cherry Studio / Open WebUI / SDKs: OpenAI provider with
http://127.0.0.1:18989/v1; seeexamples/client.mjsandexamples/client.py.
Models & Quota
| Model | Role | Native Mode | Advisory context_window |
|---|---|---|---|
gemini-neon |
Gemini 4 Neon flagship Pro reasoning & coding (gemini-argon aliases here) |
PRO (3) |
512,000 |
gemini-carbon |
Gemini 4 Carbon (Gemini app mode 8); exclusive to Google AI Ultra accounts in the Gemini app. The 512,000 value is the same advisory value as Neon (same app path) and has not been needle-tested for Carbon |
ULTRA (8) |
512,000 |
gemini-hydrogen |
Gemini 4 Hydrogen low-latency reasoning (~1.7–2.6× faster, lighter quota) | FAST (1) |
512,000 |
gemini-flash-lite |
High-throughput lightweight tasks | 6 |
— |
Empirical GetUsageInfo observations on Gemini AI Pro accounts (neon_pro_policy; not official Google SLA figures):
| Workload | gemini-hydrogen |
gemini-neon |
Neon Multiple |
|---|---|---|---|
Massive code review + rewrite (thinking=2) |
~0.12% weekly (~76s) |
~0.25% weekly (~198s) |
~2.0× |
Multi-tool agent tool_call step (thinking=2) |
~0.024% weekly (~8s) |
~0.037% weekly (~14s) |
~1.56× |
Standard ~14 KB plan (thinking=0) |
~0.017% weekly (~28s) |
~0.086% weekly (~36s) |
~5.1× |
| Est. 5-hour single-account capacity | ~40 rewrites / ~210 tool steps |
~20 rewrites / ~135 tool steps |
— |
Why Gemini App2API?
MGGA — Make Gemini Great Again: Free frontier Gemini models from a consumer chat harness into real engineering tools.
| Dimension | Gemini App2API | Web / Cookie Scrapers | Desktop Injection / MITM |
|---|---|---|---|
| Transport | Pure Node.js native HTTP/2 (ProcessQuery) + parallel image uploads |
Fragile DOM / browser cookies | Binary hooks / local MITM |
| Auth & Pool | Standard Google OAuth (0600 local state), multi-account failover & quota bars |
Frequent cookie expiry / CAPTCHA | Single active desktop GUI |
| Agent Safety | Schema-validated tools (256 declarations), hallucinated tool-result suppression, incomplete: true contract |
Unvalidated regex / broken loops | Consumer UI limits |
| Footprint | Node.js >= 22, 0 production npm dependencies |
Playwright / Python stacks | OS & binary version locked |
Highlights:
- Resilient HTTP/2 & Proxy Support:
15sHTTP/2PING+ TCP keepalives, zero-dependencyHTTPS_PROXY/HTTP_PROXY/NO_PROXYCONNECTtunneling, retryable503 SERVER_SHUTDOWNrestarts, and bounded automatic recovery. - Built for Long E2E & Agent Loops: Up to
256caller tool declarations (512 KiB/16,384nodes), structured outputs (json_schema/json_object), opt-innative_searchcitations, and parallel HTTP/2 multimodal image uploads (256images /20 MiBper image safety bounds + per-account in-memoryblobIdcaching). - Zero-Dependency Security & Trilingual Console:
0700/0600private state,scryptadmin auth, SHA-256 key vault, CSRF/Origin guards, one-clickPOST /mcptoggle & quick-connect snippets, and live per-account × per-model telemetry (English/繁體中文/简体中文, zero prompt logging).

More Console Screenshots (Light Theme & Mobile 繁體中文)
| Light Theme — Account Inspector | Mobile — Traditional Chinese (繁體中文) |
|---|---|
![]() |
![]() |
Documentation
| Document | Contents |
|---|---|
Pi Extension (extensions/pi/README.md) |
Standalone pi-gemini-app plugin for Pi Coding Agent & GooeyPi |
OpenClaw Plugin (extensions/openclaw/README.md) |
Standalone openclaw-gemini-app provider plugin for OpenClaw & ClawHub |
OpenCode Plugin (extensions/opencode/README.md) |
Standalone opencode-gemini-app native provider plugin for OpenCode (Bun & Node) |
MCP Server (extensions/mcp/README.md) |
Standalone stdio MCP server (ask_gemini, gemini_search, gemini_quota) |
Standalone CLI (extensions/cli/README.md) |
Non-interactive Unix CLI (gemini-app-cli) with --schema, -f/-i, search, and --tools readonly + bundled SKILL.md |
API Support (docs/API_SUPPORT.md) |
Endpoints, tools, structured outputs, images, native_search, error codes |
Operations (docs/OPERATIONS.md) |
.env config, Docker Compose, TLS reverse proxy, launchd, troubleshooting |
Completion Contract (docs/COMPLETION_CONTRACT.md) |
Partial-output preservation, zero-output GENERATION_FAILED, agent loop safety |
Account Lifecycle (docs/ACCOUNT_LIFECYCLE.md) · Limits (docs/LOCKS_AND_LIMITS.md) |
OAuth, ToS consent, quota telemetry, concurrency & payload bounds |
Testing (docs/CURRENT_CONTRACT_TESTS.md) · Security (SECURITY.md) · Changelog (CHANGELOG.md) |
Offline E2E suites, security model, release history |
MIT License · Disclaimer · Security Policy · Contributing
Unofficial self-hosted interoperability software. No Google binaries, credentials, tokens, accounts, or quota are distributed.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…

