gemini-web2api

Convert Google Gemini's web interface into a free, self-hosted, OpenAI-compatible API for development and experimentation.

Convert Google Gemini's web interface into a free, self-hosted, OpenAI-compatible API for development and experimentation.

The gist

gemini-web2api is an open-source Python tool that converts Google Gemini's web interface into an OpenAI-compatible API. Created by GitHub user Sophomoresty, it allows developers to access Gemini models like Flash and Pro without official API keys or costs by reverse-engineering the web application's internal communication protocol. This provides a free, self-hosted alternative for integrating Gemini's capabilities into other applications.

What it does

  • Expose Google Gemini models through a local, OpenAI-compatible REST API.
  • Support full function calling (tool use) using the OpenAI format.
  • Access multiple Gemini models, including Flash and Pro variants.
  • Run as a standalone server using pure Python or a Docker container.
  • Configure optional API key authentication for secure access.
  • Adjust the model's 'thinking depth' to control response detail and length.

How it works

The user runs a Python script from the command line, which starts a local web server. This server acts as a proxy, accepting standard OpenAI API requests and translating them into the internal format used by the Gemini web app. It sends these requests to Google's endpoints and converts the responses back to the OpenAI format. The tool is open-source, requires no external dependencies, and can be configured to use Google account cookies for full model access.

Best for

Developers who want to use Google's Gemini models through a standard OpenAI API client without needing to pay for or manage official API keys.

Watch out for

The tool does not support image or multimodal inputs. Accessing the true Pro model may require a valid cookie from a paid Google account. Each API call is a single-turn conversation, and high-frequency use may be rate-limited by Google.