A Python Wrapper That Treats Bard Cookies as API Keys
An unofficial Python wrapper that reverse-engineered Google Bard’s web interface to tide developers over until an official API arrived.

What it does
Bard-API is an unofficial Python wrapper that lets you query Google Bard by passing your browser’s __Secure-1PSID cookie as a token. It was built as a lightweight testing aid while waiting for an official API, and the README repeatedly warns that it is neither a free service nor a production solution.
The interesting bit
The project opens with Development Status :: 7 - Inactive and immediately redirects you to the author’s newer python-gemini-api, because Bard has become Gemini. It is a refreshingly honest reverse-engineering tool that admits its own obsolescence from the first line.
Key highlights
- Reverse-engineered from Bard’s web interface, drawing on earlier work by
acheong08 - Authenticates via the
__Secure-1PSIDcookie, which the README notes changes every 15–20 minutes - Supports proxies, reusable sessions, async clients, image prompts, and text-to-speech responses
- Author explicitly recommends using official PaLM-2 or Google Generative AI APIs if you have access
- Now superseded by
Gemini-API, reflecting Bard’s rebranding to Gemini
Caveats
- Cookie-based authentication is inherently fragile; sessions expire frequently and rate limits shift without warning
- The author discourages any use beyond testing, and notes that headless automation is challenging
Verdict Treat this as a historical artifact for studying pre-official-API LLM access, or follow the README’s own advice and skip straight to the official Gemini API.
Frequently asked
- What is dsdanielpark/Bard-API?
- An unofficial Python wrapper that reverse-engineered Google Bard’s web interface to tide developers over until an official API arrived.
- Is Bard-API open source?
- Yes — dsdanielpark/Bard-API is open source, released under the MIT license.
- What language is Bard-API written in?
- dsdanielpark/Bard-API is primarily written in Python.
- How popular is Bard-API?
- dsdanielpark/Bard-API has 5.2k stars on GitHub.
- Where can I find Bard-API?
- dsdanielpark/Bard-API is on GitHub at https://github.com/dsdanielpark/Bard-API.