RadarTopicsBuildersWeeklyReads
Open Source Radar
HanaokaYuzu/

Gemini-API

GitHubWebsite

Gemini-API is a Python async wrapper to interact with Google Gemini web app, featuring image/video generation, deep research, and a CLI. It supports cookies management, streaming, and model selection with dynamic discovery.

3.4kstars
535forks
49issues
AGPL-3.0license
2024since
Star historydaily snapshots by VibeCrowd

Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).

Alternatives & relatedmatched by topic overlap
Reviewgenerated from repository data · Aug 5, 2026

What it is

Gemini-API is a reverse-engineered asynchronous Python wrapper for the Google Gemini web app (formerly Bard).

How it works

The library provides an asynchronous client (GeminiClient) that initializes with cookies, refreshes cookies in the background, and exposes methods to generate content, read history, manage chats, and stream outputs. It supports optional browser-cookie3 integration via a specific installation tag gemini_webapi[browser]. It also includes a CLI tool and a range of configuration options for timeouts, auto_close behavior, and auto_refresh.

Getting started

Install or update the package with pip:

pip install -U gemini_webapi

Optionally install with browser cookies support:

pip install -U gemini_webapi[browser]

Authentication requires obtaining the cookies from gemini.google.com as described in the README and then initializing GeminiClient with cookies. An example snippet is provided in the Usage section showing how to construct GeminiClient with Secure_1PSID and Secure_1PSIDTS and call init.

Usage highlights

  • Initialize and auto-refresh cookies in the background while the process is alive.
  • Generate content via GeminiClient.generate_content and read text via the response's text attribute.
  • Generate content with files by passing a files list to generate_content.
  • Start a chat with client.start_chat() and send messages via ChatSession, with automatic history handling.
  • Read chat history with client.read_chat(chat.cid).
  • List chats with client.list_chats() and delete chats with client.delete_chat(chat.cid).
  • Streaming mode via client.generate_content_stream yields ModelOutput chunks with text_delta for new characters.
  • Select language model via model parameter; models are discovered dynamically at init based on account tier; Model enum is available.

Getting started (examples)

import asyncio
from gemini_webapi import GeminiClient

Secure_1PSID = "COOKIE VALUE HERE"
Secure_1PSIDTS = "COOKIE VALUE HERE"

async def main():
    client = GeminiClient(Secure_1PSID, Secure_1PSIDTS, proxy=None)
    await client.init(timeout=30, auto_close=False, close_delay=300, auto_refresh=True)

asyncio.run(main())
# Generate content
response = await client.generate_content("Hello World!")
print(response.text)
# Generate content with files
response = await client.generate_content(
        "Introduce the contents of these two files. Is there any connection between them?",
        files=["assets/sample.pdf", Path("assets/banner.png")],
    )
print(response.text)

Recent releases

  • v2.0.0 (2026-04-06): added support for video and audio generation, as well as downloading generated image in full size; added support for deep research; added a CLI tool; added su
  • v1.21.0 (2026-03-06): read chat history by chat id; gemini_webapi[browser] installation option to bundle browser-cookie3; fix: update gemini-3.0-pro
  • v1.20.0 (2026-03-03): add temporary single-call mode; fix: allow init without SNlM0e token
  • v1.19.2 (2026-02-14): fix retry logic for zombie stream
  • v1.19.1 (2026-02-10): fix retry logic for unsaved conversations

Traction

3372 stars, 535 forks, 49 open issues

License and age

AGPL-3.0 licensed; created 2024-02-11; last_push 2026-08-03

SharePost on XLinkedIn
All trending reposRevenue-verified startups →