Nativu5/Gemini-FastAPI

Web-based Gemini models wrapped into an OpenAI-compatible API.

What it solves

Gemini-FastAPI provides a way to access Google's web-based Gemini models via an API without requiring an official Google API key. It wraps these models into an OpenAI-compatible API, allowing users to integrate Gemini into existing tools and applications that expect the OpenAI format.

How it works

The project uses web cookies (__Secure-1PSID and __Secure-1PSIDTS) from a signed-in Google account to authenticate requests to Gemini's web interface. It is powered by the Gemini-API library. The server is built with FastAPI and supports multi-turn conversations using LMDB-based storage for persistence.

Who it’s for

Developers who want to use Gemini's web-based capabilities—including Google Search integration and multi-modal inputs—for free, or those who need an OpenAI-compatible endpoint for their Gemini-powered applications.

Highlights

  • OpenAI Compatibility: Supports /v1/chat/completions and /v1/models endpoints, including streaming, tool calling, and structured JSON output.
  • No API Key Needed: Uses session cookies for authentication, enabling free access to web-based models.
  • Multi-modal Support: Handles text, images, and file uploads.
  • Load Balancing: Distributes requests across multiple Google accounts with individual proxy settings to manage rate limits.
  • Context Management: Offers strategies like compaction (summarizing older turns) or file attachment for handling oversized contexts.
  • Conversation Persistence: Uses LMDB to maintain conversation history across sessions.

Related

  • Project
  • Project
  • Project
  • Project
  • Project