Skip to main content

A Python CLI tool that bridges Playwright-based Google authentication with the gemini-webapi library

Project description

GemiTerm

Access and manage your Gemini web chats from the command line. GemiTerm bridges Playwright-based Google authentication to let you list, fetch, export, and continue conversations trapped in the Gemini web interface — without a standard API.

Installation

Windows (standalone - no Python required)

Open PowerShell and run:

irm https://raw.githubusercontent.com/expert-vision-software/GemiTerm/main/install.ps1 | iex

This downloads the latest GemiTerm.exe, installs Chromium browser, and adds GemiTerm to your PATH.

Uninstall:

irm https://raw.githubusercontent.com/expert-vision-software/GemiTerm/main/install.ps1 | iex -- -uninstall

Linux

Download the GemiTerm binary from the latest release.

chmod +x GemiTerm
./GemiTerm install-browser  # install Chromium if needed

pip/pipx (requires Python)

pip install gemiterm       # global install
pipx install gemiterm      # global install (isolated)
pipx run gemiterm auth     # temporary run (npx equivalent)

From Source

pip install -e .
playwright install chromium

Prerequisites

  • Chromium Browser: GemiTerm will attempt to use your system Chrome if available, otherwise it installs Playwright's Chromium automatically.
  • Google Account: A Google account with access to Gemini (https://gemini.google.com)

Usage

Authentication

Before using the CLI, you need to authenticate with your Google account:

gemiterm auth

This will open a browser window for you to log in with your Google account. Cookies will be saved for future use.

Check Status

Verify your authentication status:

gemiterm status

List Chats

Display all your Gemini chats in a table:

gemiterm list

Options:

  • -n, --limit N: Maximum number of chats to display (default: 10, max: 50)

Fetch Chat History

Fetch and display the message history of a specific conversation:

gemiterm fetch <conversation_id>

Options:

  • --format, -f: Output format - text (default) or json

Continue a Chat

Send a message to an existing conversation:

gemiterm continue <conversation_id> <message>

Export Chat

Export a conversation to a Markdown file:

gemiterm export <conversation_id>

Options:

  • -o, --output PATH: Custom output file path
  • -f, --format FORMAT: Export format - markdown (default) or json
  • --include-metadata: Include full metadata in export

Export All Chats

Export all conversations to a directory with an index file:

gemiterm export-all

Options:

  • -o, --output-dir PATH: Directory to export to (default: ./exports)
  • --since ISO_DATE: Export only conversations newer than this date
  • --include-metadata: Include full metadata in each export

Verbose Logging

Enable detailed logging for debugging:

gemiterm -v <command>

Configuration

Configuration Directory

Default location: ~/.config/gemiterm/

Override with environment variable:

export GEMITERM_CONFIG_DIR=/custom/path

Storage File

The storage file (storage_state.json) contains your authentication cookies. It is located in the configuration directory.

Environment Variables

Variable Description Default
GEMITERM_CONFIG_DIR Configuration directory ~/.config/gemiterm/
GEMITERM_VERBOSE Enable verbose logging false

Troubleshooting

Browser Automation Issues

If browser automation fails or is unavailable, you can manually extract cookies from your browser:

  1. Install the "EditThisCookie" extension or similar in your browser
  2. Go to https://gemini.google.com and log in
  3. Export the cookies in JSON format
  4. Save them to ~/.config/gemiterm/storage_state.json with the following format:
    {
      "cookies": [
        {"name": "__Secure-1PSID", "value": "your_value_here", ...},
        {"name": "__Secure-1PSIDTS", "value": "your_value_here", ...}
      ]
    }
    

Session Expired

If you see "Session expired" errors:

  1. Run gemiterm auth to re-authenticate
  2. If the issue persists, delete storage_state.json and run gemiterm auth again

API Errors

If you encounter API errors:

  1. Run gemiterm status to check your authentication state
  2. Ensure you have a valid Google account with Gemini access
  3. Try re-authenticating with gemiterm auth

Verbose Logging

Use the -v or --verbose flag to enable detailed logging for debugging:

gemiterm -v list

Future Enhancements

  • Interactive CLI mode with menu-driven navigation
  • REPL mode for conversational interaction
  • Support for conversation creation and deletion
  • Export to multiple formats (HTML, PDF)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemiterm-1.2.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemiterm-1.2.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file gemiterm-1.2.0.tar.gz.

File metadata

  • Download URL: gemiterm-1.2.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gemiterm-1.2.0.tar.gz
Algorithm Hash digest
SHA256 68831271c25ad6b9d4f25ff365c324079c6063852f5ff076e80f5f7a4b6c36f2
MD5 5da7f2bb52b4a9905c3ecce229a287c1
BLAKE2b-256 bc16eef0cd923f620ed7330877af9199e45ca80bef987523d70d2fa087c27cbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemiterm-1.2.0.tar.gz:

Publisher: release.yml on Expert-Vision-Software/gemiterm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gemiterm-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: gemiterm-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gemiterm-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8e202a6811a2ec69efee614b048b3ccafb2b3f4ec99f9dee480b81f757ea9f8
MD5 357d13d26ba05bcf6f095501bb69679f
BLAKE2b-256 4937c077313b85686ad80689cade6081358981881324bbb46ca5c3156f573602

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemiterm-1.2.0-py3-none-any.whl:

Publisher: release.yml on Expert-Vision-Software/gemiterm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page