Gemini-API: a reverse-engineered asynchronous Python wrapper for the Google Gemini web app
Gemini-API: a reverse-engineered asynchronous Python wrapper for the Google Gemini web app
What it solves
It provides a way to programmatically interact with the Google Gemini web app (formerly Bard) using a reverse-engineered asynchronous Python wrapper, allowing developers to use Gemini's web-based features without relying on the official API.
How it works
The library acts as a wrapper around the Gemini web interface. It uses session cookies (__Secure-1PSID and __Secure-1PSIDTS) for authentication and implements an asynchronous client using asyncio to send requests and receive responses. It includes a background mechanism to automatically refresh cookies to maintain persistent sessions for always-on services.
Who it’s for
Python developers who want to integrate Gemini's web-app capabilities—such as image/video/audio generation, deep research, and Gemini Gems—into their own applications or scripts.
Highlights
- Multimodal Capabilities: Supports generating and editing images, as well as generating video and audio/music content.
- Deep Research: Implements a full workflow for plan creation, status polling, and result retrieval.
- Gemini Gems Support: Allows applying, creating, updating, and deleting custom system prompts (Gems).
- Extension Integration: Supports using Gemini extensions like YouTube and Gmail.
- Advanced Session Management: Features persistent cookies with auto-refresh and a temporary mode that doesn't save conversations to history.
- Developer-Friendly: Includes a CLI tool, streaming mode for real-time responses, and an interface inspired by the official Google Generative AI API.
Sources
- undefinedHanaokaYuzu/Gemini-API