Python SDK for accessing the Bard chatbot via reverse engineering
Top 29.4% on sourcepulse
This project provides a Python SDK and API for interacting with Google Bard, a large language model chatbot. It is designed for developers and researchers who want to integrate Bard's capabilities into their applications or explore its functionality programmatically. The SDK allows for both synchronous and asynchronous interactions, offering flexibility for various use cases.
How It Works
The project reverse-engineers the Google Bard API, enabling programmatic access without an official SDK. It relies on obtaining authentication cookies (__Secure-1PSID
and __Secure-1PSIDTS
) from a user's browser session on bard.google.com. These cookies are then used to authenticate requests to the Bard backend, allowing the SDK to send prompts and receive responses.
Quick Start & Requirements
pip3 install --upgrade GoogleBard
__Secure-1PSID
, __Secure-1PSIDTS
) obtained from a browser session.https://bard.google.com/
via browser developer tools (F12 -> Application -> Cookies).python3 -m Bard
) or directly within Python scripts using Chatbot
or AsyncChatbot
classes. Environment variables (BARD__Secure_1PSID
, BARD__Secure_1PSIDTS
) can be set for convenience.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
This project is based on reverse-engineered APIs, which are subject to change or deprecation by Google without notice. The reliance on browser cookies for authentication may also pose security considerations and potential instability if Google modifies its authentication mechanisms.
2 years ago
1+ week