Bard-API  by dsdanielpark

Python SDK for accessing Google Gemini (formerly Bard) via cookie value

created 2 years ago
5,251 stars

Top 9.8% on sourcepulse

GitHubView on GitHub
Project Summary

This Python package provides an unofficial interface to Google Bard (now Gemini), enabling developers to interact with the conversational AI using cookie values for authentication. It's designed for testing and development purposes, offering a lightweight alternative while Google's official APIs are in development.

How It Works

The package reverse-engineers the inference process of Google Bard/Gemini, utilizing the __Secure-1PSID cookie obtained from a user's browser session. This approach bypasses the need for official API keys, allowing direct interaction with the service by mimicking a logged-in user.

Quick Start & Requirements

  • Install: pip install bardapi or pip install git+https://github.com/dsdanielpark/Bard-API.git
  • Authentication: Requires a __Secure-1PSID cookie value from gemini.google.com.
  • Dependencies: Python.
  • Setup: Requires manual cookie extraction.

Highlighted Details

  • Supports synchronous and asynchronous requests.
  • Includes features for image-based queries and text-to-speech.
  • Offers proxy support and rotating proxy integration for enhanced reliability.
  • Provides an "Auto Cookie" feature using browser_cookie3 for simplified authentication.

Maintenance & Community

The project is marked as "Inactive" in development status, with a recommendation to use the python-gemini-api package. Core maintainers include Antonio Cheong and Daniel Park.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: Permissive for commercial use, but the README strongly advises against misuse and highlights potential account restrictions from Google for excessive or commercial usage.

Limitations & Caveats

This package is unofficial and relies on reverse-engineered methods, making it susceptible to breakage with Google's service updates. Cookie values change frequently, requiring periodic re-authentication. Image query functionality is experimental and may not be universally available. The project is marked as inactive, with a successor project recommended.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
5 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.