gemini-web2api
Convert Google Gemini web into OpenAI-compatible API. Zero auth, cross-platform, single file.
Gemini-web2api is a single Python file that runs a local server on your computer and makes Google's Gemini AI accessible through the same API format that OpenAI uses. Any application that already knows how to talk to OpenAI's ChatGPT API can be pointed at this local server instead, and it will work without changes. This means tools like Cherry Studio, the OpenAI Python library, and many other chat clients can use Gemini without needing an official Gemini API key.
The tool works by reverse-engineering the internal web protocol that the Gemini website uses in your browser. It translates incoming requests from the OpenAI format, forwards them to Google's web endpoint, and translates the responses back. Since it uses the web interface rather than a paid API, it costs nothing beyond your existing Google account. Anonymous access works for the faster Flash models. Getting access to the Pro model requires exporting cookies from your browser after signing in with a free Google account and providing that cookie file to the server.
Several Gemini models are available through the server including Flash, Flash Thinking, Pro, and Lite variants. The thinking depth of the reasoning models can be adjusted by appending a parameter to the model name. The server also supports streaming responses so answers appear word by word, tool calling so AI agents can invoke functions you define, and web search so Gemini can look things up as part of answering a question.
The README is upfront about the limitations. Images cannot be sent because the file upload protocol used by the Gemini website is proprietary and cannot be replicated. Each request is independent, so multi-turn conversation works only by including the full conversation history in each new request. Google may slow down or block high-frequency use.
The entire project has no external Python dependencies beyond the standard library. It can also be run inside Docker with a configuration file for persistent settings.