gemini-web2api
Provides an OpenAI-compatible local gateway to Google Gemini Web, enabling chat completions, model access, extended thinking, and tool calling for coding agents and MCP workflows.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
π Gemini Web2API Gateway
A high-performance local developer gateway bridging Google Gemini Web to OpenAI-compatible clients, Anthropic Claude agents, and Model Context Protocol (MCP) workflows.
π Overview
Gemini Web2API Gateway is an open-source multi-protocol bridge that translates your Google Gemini Web session into standardized, drop-in replacement REST APIs for:
OpenAI API (
/v1/chat/completions,/v1/models)Anthropic Claude Messages API (
/v1/messages,/claude/v1/messages)Gemini Deep Research (
/gemini/v1beta/interactions)OpenAI Codex Responses (
/v1/responses)Google GenAI Native REST (
/v1beta/models/...)
Designed specifically for developers, researchers, and agentic workflows, it connects Gemini Web directly to IDE plugins, local developer tools, and autonomous coding assistants like Claude Code, Cline, OpenCode, Cursor, and OpenDevin without protocol incompatibilities.
Related MCP server: Gemini CLI MCP/OpenAI Bridge
ποΈ Architecture & Workflow
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Developer Clients β
β OpenCode β’ Cline β’ Cursor β’ Claude Code β’ OpenDevin β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β Standard OpenAI (/v1) or Claude (/v1/messages)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Gemini Web2API Gateway β
β β’ Anthropic Claude Adapter (translates messages, system & thinking) β
β β’ Agent Tool Adapter (formats MCP schemas & parallel tool execution) β
β β’ Deep Research Engine (autonomous multi-stage web-grounded research) β
β β’ Hardened Scotty Resumable Upload (multimodal vision + fallback) β
β β’ Anti-Extension Keyword Sanitizer (avoids Google Workspace traps) β
β β’ Conversation Compactor (preserves agent state up to 300k chars) β
βββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ
β SQLite Session Pool & Router β β Browser Companion Extension β
β β’ Multi-Account Rotation & Failover β β β’ Multi-Profile Sync β
β β’ Cooldown Backoff Tracking β β β’ Automated Session Refreshβ
β β’ Account-Specific API Keys β β β’ Background Worker Keep β
βββββββββββββββββββββ¬ββββββββββββββββββββ ββββββββββββββββ¬βββββββββββββββ
β β
βββββββββββββββββββββ¬ββββββββββββββββββ
β HTTPS Session Stream
βΌ
βββββββββββββββββββββββββββββββββ
β Google Gemini Web β
β 3.8 Flash β’ 3.5 Lite β’ Pro β
β Deep Research β’ Web Search β
βββββββββββββββββββββββββββββββββπ Key Highlights
π Universal Multi-Protocol Support:
Full OpenAI compatibility (
/v1/chat/completions,/v1/models).Full Anthropic Claude compatibility (
/v1/messages,/claude/v1/messages,/v1/messages/count_tokens).Native Gemini Deep Research pipeline (
/gemini/v1beta/interactions).
π Frontier & Extended Reasoning:
Out-of-the-box support for Gemini 3.8 Flash, Gemini 3.5 Flash-Lite, and Gemini 3.1 Pro.
Drop-in aliases for Claude 3.7 Sonnet, Claude 3.5 Sonnet, Claude 3.5 Haiku, GPT-4o, and GPT-4.
Thinking depth adjustable on any model via
@think=0suffix.
πΌοΈ Hardened Scotty Resumable Multimodal Upload:
Dual authentication (page tokens + static internal fallback
Basic c2F2...).Auto-compression and support for base64 data URIs, raw base64, Claude image blocks, and URLs.
π‘οΈ Anti-Extension Keyword Sanitizer:
Prevents Gemini's pre-flight classifier from mistakenly flagging prompts containing words like "Google Docs", "Google Drive", "Gmail", "YouTube", or "Webflow" with permission traps.
β‘ Autonomous Agent Optimizations:
300k-character smart compactor preserves Cline / OpenCode / Claude Code state machines during massive parallel tool loops.
βοΈ Cloudflare Edge Worker Edition:
Includes
./cloudflare/worker.jsand./cloudflare/wrangler.tomlfor 1-click zero-cost serverless deployment on Cloudflare Workers.
π Real-time Web Dashboard:
Interactive HTML dashboard (
/dashboardor/) with live multi-protocol playground, account health checks, and sync triggers.
π Model Directory & Aliases
Model ID (API Name) | Protocol Target | Reasoning Engine | Recommended For |
| OpenAI / Claude / Native | Standard | General coding, fast completions, small edits |
| OpenAI / Claude / Native | π§ Extended ( | Autonomous coding agents, MCP, complex logic |
| Anthropic Claude ( | π§ Extended | Claude Code, Cursor, complex agentic workflows |
| Anthropic Claude ( | π§ Extended | High-accuracy code architecture & refactoring |
| Anthropic Claude ( | Standard ( | Ultra-fast token streaming, summaries, lookups |
| Interactions / OpenAI | π Grounded Research | Multi-source investigation and report generation |
| OpenAI / Claude / Native | Standard ( | Gemini Advanced subscribers |
| OpenAI drop-in | π§ Extended | Tools with hardcoded model selectors |
π Quick Start
1. Installation
git clone https://github.com/javedhamzabwn/gemini-web2api.git
cd gemini-web2api
pip install -r requirements.txt2. Start the Gateway
On Windows:
Double-click start_manager.bat and select option 4.
Or via Command Line:
python -m gemini_web2api --port 10012Access the Web Dashboard at: http://localhost:10012/
π οΈ Client Configuration
1. Claude Code / Terminal Agent
export ANTHROPIC_BASE_URL="http://localhost:10012"
export ANTHROPIC_API_KEY="sk-gemini-example-key"
export CLAUDE_MODEL="claude-3-7-sonnet"
claude2. Cline / Roo Code (VS Code Extension)
API Provider:
AnthropicorOpenAI CompatibleBase URL:
http://localhost:10012(for Anthropic) orhttp://localhost:10012/v1(for OpenAI)API Key:
sk-gemini-example-keyModel ID:
claude-3-7-sonnetorgemini-3.8-flash-thinking
3. OpenCode / OpenCode Studio
In your custom provider settings:
Provider:
OpenAI-CompatibleBase URL:
http://localhost:10012/v1API Key: Enter any key or your account-specific key.
Model:
gemini-3.8-flash-thinking
4. Cursor / Continue.dev
In .cursorrules or continue/config.json:
{
"models": [
{
"title": "Gemini 3.8 Flash Thinking",
"provider": "openai",
"model": "gemini-3.8-flash-thinking",
"apiBase": "http://localhost:10012/v1",
"apiKey": "sk-gemini-example-key"
},
{
"title": "Claude 3.7 Sonnet (via Gemini)",
"provider": "anthropic",
"model": "claude-3-7-sonnet",
"apiBase": "http://localhost:10012",
"apiKey": "sk-gemini-example-key"
}
]
}π§ͺ End-to-End Verification
A comprehensive automated test suite is included:
python -m unittest tests.test_end_to_endCovers:
OpenAI
/v1/chat/completionscompatibilityAnthropic Claude
/v1/messagesnon-streaming, streaming, and tool callsToken estimation
/v1/messages/count_tokensScotty resumable upload MIME parsing and image extraction
Deep Research plan generation and synthesis
Live server dispatch and multi-account SQLite session integrity
βοΈ Cloudflare Edge Worker Deployment
To deploy serverless on Cloudflare's edge network:
Navigate to the
cloudflare/directory:cd cloudflareConfigure your secret cookie:
npx wrangler secret put COOKIE_STRINGDeploy:
npx wrangler deploy
See cloudflare/README.MD for full details.
π License
Distributed under the MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Talk to your public-facing AI from any MCP client β Claude, ChatGPT, Cursor, Cline, Windsurf.
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceBridges Google's Gemini CLI with MCP-compatible clients and integrates OpenRouter API for access to 400+ AI models. Provides 33 specialized tools enabling multi-AI workflows, collaborations, and debates between Claude, Gemini, and other LLMs.142-
- AlicenseNot gradedqualityFmaintenanceExposes Gemini CLI's built-in tools and external MCP proxies through a unified MCP endpoint while providing an OpenAI-compatible API for Gemini models. It features configurable security modes to safely manage file system operations, web searches, and shell command execution.138Apache 2.0
- AlicenseAqualityFmaintenanceMCP server for querying Google Gemini Web from Claude Code and other MCP clients, using cookie-based authentication. Enables creating, continuing, listing, viewing, and deleting Gemini chat conversations with model and thinking mode control.6AGPL 3.0
- FlicenseNot gradedqualityDmaintenanceProvides OpenAI-compatible API, MCP, and CLI for Google AI Mode, with automatic fallback to a real Chrome browser to bypass TLS fingerprint detection.3-