Practical overview
When it fits
Use it when a Python application or CLI needs to interact with Gemini web-app capabilities and the documented cookie-based authentication approach fits the project.
Who it is for
- Python developers integrating Gemini web-app interactions into applications
- Developers building chat integrations or prototypes involving Gemini generation and research workflows
- Users who want to interact with Gemini from a command line
Documented uses
- Send prompts and continue multi-turn conversations through a Python client
- Submit image or document files alongside a prompt
- Stream partial outputs and handle classified response content
- Use documented image, video, audio, and deep-research workflows
- Ask questions, continue chats, and conduct deep research through the CLI
Requirements & limits
The package requires Python 3.11 or higher. The documented client authentication uses cookies from a Google account logged in to gemini.google.com; the CLI requires a cookies JSON file. The project is licensed under AGPL-3.0.
- The wrapper is reverse-engineered and interacts with the Gemini web app rather than being Google's official API.
- The README documents cookie refresh and optional cookie import through
browser-cookie3; Firefox is the browser identified for that optional dependency. - For containerized applications, the README describes persisting refreshed cookies with a writable
GEMINI_COOKIE_PATH.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install the library and prepare Gemini authentication
Set up the Python package and the cookie-based authentication required to initialize its client.
Before you start
- Python 3.11 or higher
- A Google account logged in to gemini.google.com
- pip
Steps
Install the package with the command below.
pip install -U gemini_webapiLog in to gemini.google.com, open the browser's web inspector, select Network, and refresh the page.
Copy the
__Secure-1PSIDand__Secure-1PSIDTScookie values from a request for use when initializing the client.
Expected outcome
The package is installed and the cookie values needed for client initialization are available.
Guide limitations
- The documented cookie-import alternative requires the optional
browser-cookie3dependency; the README identifies Firefox as supported. - This guide covers setup and authentication, not a completed request or successful runtime.
Prepare cookies for the command-line tool
Create the cookie file required to use the documented Gemini API CLI.
Before you start
- Python 3.11 or higher
- Cookies exported from a logged-in Gemini web session
- A JSON file for the exported cookies
Steps
Export cookies from gemini.google.com.
Save them in a JSON file using the documented
__Secure-1PSIDand__Secure-1PSIDTSkeys, or use a supported browser-cookie-extension export format.Provide the file to the CLI with its required
--cookies-json PATHoption.
Expected outcome
The CLI has a cookie file in the documented format for its commands.
Guide limitations
- This guide covers cookie preparation and the required CLI option, not execution of a CLI command.
- The CLI persists updated cookies to the JSON file after each run unless
--no-persistis used.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 10 October 2026
- Original website title
- HanaokaYuzu/Gemini-API · Official homepage title · retained in its source language

