Gemini-API  by HanaokaYuzu

Async Python API for Google Gemini web app

created 1 year ago
935 stars

Top 40.1% on sourcepulse

GitHubView on GitHub
Project Summary

This Python package provides an asynchronous API wrapper for the Google Gemini web application, targeting developers who need to integrate Gemini's advanced AI capabilities into their applications. It offers features like persistent cookies, image generation, extension support, and classified outputs, aiming for an elegant and efficient integration.

How It Works

The library reverse-engineers the Gemini web app's API, enabling programmatic access to its features. It utilizes asyncio for efficient, non-blocking operations, crucial for always-on services. Key features include automatic cookie refreshing to maintain session persistence and native support for image generation and manipulation via natural language prompts, leveraging Google's Imagen3 model. It also allows interaction with Gemini extensions like Gmail and YouTube, and categorizes responses, including AI-generated images.

Quick Start & Requirements

  • Install with: pip install -U gemini_webapi
  • For cookie import: pip install -U browser-cookie3
  • Requires Python 3.10+.
  • Authentication involves obtaining __Secure-1PSID and __Secure-1PSIDTS cookies from your browser session.
  • Official documentation: [Not explicitly linked, but implied by usage examples]

Highlighted Details

  • Asynchronous operations via asyncio.
  • Persistent cookies with automatic background refreshing.
  • Native image generation and modification support.
  • Gemini extension integration (Gmail, YouTube).
  • Automatic classification of text, web, and AI-generated images.
  • Supports multiple Gemini models, including experimental and advanced versions.
  • Allows conversation history persistence and retrieval.

Maintenance & Community

  • No specific contributors, sponsorships, or community links (Discord/Slack) are mentioned in the README.

Licensing & Compatibility

  • The README does not specify a license.

Limitations & Caveats

  • Image generation and extension features have regional and age-based limitations as per Google's official documentation.
  • The auto-refresh cookie feature may require re-logging into Google accounts in the browser, with a recommendation to use private browsing sessions for cookie extraction.
Health Check
Last commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
6
Star History
436 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.