Skip to main content

Gemini AI CLI Tool for automation

Project description

Gemini AI Automation Tool

geminiai-cli logo

Build status PyPI version Python Code style: black Ruff License: MIT Maintenance

The Swiss Army Knife for Gemini AI Automation - Backups, Cloud Sync, and Account Management.

geminiai-cli is a powerful, "batteries-included" command-line interface designed to supercharge your Gemini AI experience. It handles backups (Local, S3, B2), synchronizes data across devices, manages multiple profiles, and intelligently tracks account usage to bypass rate limits.


โšก Quick Start (The "5-Minute Rule")

Prerequisites

Installation

# Install from PyPI
pip install geminiai-cli

# Or install from source
pip install .

Get Started Immediately

Copy and paste this snippet to configure your first profile, backup to the cloud, and verify your system health.

# 1. Run the interactive setup wizard
geminiai config --init

# 2. Run your first local backup
geminiai backup

# 3. Push your backup to the cloud (requires configured credentials)
geminiai sync push

# 4. Check the system health
geminiai doctor

# 5. See your usage stats
geminiai stats

โœจ Features

  • ๐Ÿ›ก๏ธ God Level Backups: Securely backup your configuration and chat history to Local, AWS S3, or Backblaze B2 storage. Supports GPG Encryption for sensitive data.
  • โ˜๏ธ Unified Cloud Sync: Seamlessly push and pull backups between your local machine and the cloud. Treat your backups like Git repositories.
  • ๐Ÿง  Smart Recommendation Engine: Automatically identifies and switches to the "Next Best Account" based on cooldown timers and Least Recently Used (LRU) logic.
  • โ„๏ธ Cooldown Tracking: Intelligently tracks rate limits and cooldown periods to maximize your free tier usage without interruptions.
  • ๐Ÿ‘ค Multi-Profile Support: manage isolated environments (e.g., --profile work, --profile personal) with distinct configurations and history.
  • ๐Ÿ’ฌ Chat Management: Dedicated tools to backup, restore, resume, and clean up chat sessions.
  • ๐Ÿ“Š Visual Analytics: View beautiful, terminal-based bar charts of your usage history over the last 7 days.
  • ๐Ÿฉบ Doctor Mode: Built-in diagnostic tool to validate your environment, dependencies, and configuration health.

๐Ÿ› ๏ธ Configuration

You can configure geminiai-cli using Environment Variables, CLI Arguments, or the Interactive Config (geminiai config --init).

Priority Order: CLI Arguments > Environment Variables > .env / Doppler > Saved Config (~/.geminiai-cli/settings.json)

Environment Variables

Variable Description Default Required
GEMINI_AWS_ACCESS_KEY_ID AWS Access Key ID for S3. None No (for S3)
GEMINI_AWS_SECRET_ACCESS_KEY AWS Secret Access Key for S3. None No (for S3)
GEMINI_S3_BUCKET AWS S3 Bucket Name. None No (for S3)
GEMINI_S3_REGION AWS Region. us-east-1 No
GEMINI_B2_KEY_ID Backblaze B2 Application Key ID. None No (for B2)
GEMINI_B2_APP_KEY Backblaze B2 Application Key. None No (for B2)
GEMINI_B2_BUCKET Backblaze B2 Bucket Name. None No (for B2)
GEMINI_BACKUP_PASSWORD Password for GPG encryption. None No (for --encrypt)
DOPPLER_TOKEN Token for Doppler secrets management. None No

CLI Commands & Arguments

Command Description Key Flags
backup Create a new backup. --cloud, --encrypt, --src <path>
restore Restore from a backup. --cloud, --auto (smart restore), --force
sync Sync local & cloud backups. push, pull, --bucket <name>
chat Manage chat history. backup, restore, cleanup, resume
config Manage settings. --init (wizard), set, get, list
doctor System diagnostics. (None)
stats View usage charts. (None)
recommend Get next account suggestion. (None)
profile Manage profiles. export, import
cooldown Manage account cooldowns. --remove <email>

๐Ÿ—๏ธ Architecture

The geminiai-cli is built with modularity and extensibility in mind.

src/geminiai_cli/
โ”œโ”€โ”€ cli.py             # ๐Ÿš€ Entry Point & Argument Routing
โ”œโ”€โ”€ config.py          # โš™๏ธ Global Constants & Paths
โ”œโ”€โ”€ backup.py          # ๐Ÿ“ฆ Backup Logic (Local & Cloud dispatch)
โ”œโ”€โ”€ restore.py         # โ™ป๏ธ Restore Logic (Auto-selection)
โ”œโ”€โ”€ sync.py            # ๐Ÿ”„ Unified Sync (Push/Pull)
โ”œโ”€โ”€ cloud_factory.py   # โ˜๏ธ Cloud Provider Abstract Factory
โ”œโ”€โ”€ cloud_s3.py        # ๐Ÿ”ถ AWS S3 Implementation
โ”œโ”€โ”€ b2.py              # ๐Ÿ”ฅ Backblaze B2 Implementation
โ”œโ”€โ”€ chat.py            # ๐Ÿ’ฌ Chat Session Management
โ”œโ”€โ”€ recommend.py       # ๐Ÿง  Recommendation Engine (LRU + Health)
โ”œโ”€โ”€ cooldown.py        # โ„๏ธ Cooldown & Rate Limit Tracking
โ”œโ”€โ”€ stats.py           # ๐Ÿ“Š Visualization Module
โ””โ”€โ”€ doctor.py          # ๐Ÿฉบ Diagnostics & Health Checks

Data Flow:

  1. User Input: Commands are parsed by argparse in cli.py.
  2. Configuration: Settings are loaded from Env Vars and settings.json.
  3. Execution: The appropriate module (e.g., backup.py) is invoked.
  4. Cloud Operations: If cloud flags are present, cloud_factory.py instantiates the correct provider (S3 or B2).
  5. Output: Results and logs are displayed using rich for a beautiful terminal experience.

๐Ÿž Troubleshooting

If you encounter issues, run geminiai doctor first. It checks dependencies, permissions, and configuration validity.

Error Message Possible Cause Solution
B2ConnectionError Invalid B2 credentials. Run geminiai config --init or check GEMINI_B2_* env vars.
S3UploadFailed Bucket does not exist or permission denied. Verify GEMINI_S3_BUCKET name and AWS IAM permissions.
GPG not found gpg is not installed. Install GPG (apt install gpg / brew install gnupg).
Permission denied CLI cannot write to ~/.geminiai-cli. Ensure you have write permissions to your home directory.
No backups found No local backups exist. Run geminiai backup or geminiai sync pull.

Debug Mode: To see detailed error tracebacks, the tool automatically prints stack traces on unhandled exceptions. Ensure your terminal supports ANSI colors for best readability.


๐Ÿค Contributing

We welcome contributions! Whether it's reporting a bug, suggesting a feature, or writing code.

  1. Check out our CONTRIBUTING.md (if available) or simply fork the repo.
  2. Setup Dev Environment:
    git clone https://github.com/dhruv13x/geminiai-cli.git
    cd geminiai-cli
    pip install -e .[dev]
    
  3. Run Tests:
    pytest tests/
    
  4. Linting:
    ruff check src/
    black src/
    

๐Ÿ—บ๏ธ Roadmap

We are constantly improving geminiai-cli. Here is a glimpse of what is coming:

  • Phase 1 (Completed): Core Backup/Restore, Multi-Cloud (S3/B2), Sync, Auto-Updates.
  • Phase 2 (Current): Smart Recommendations, Usage Stats, Profiles, Doctor Mode.
  • Phase 3 (Upcoming):
    • ๐Ÿ”” Webhooks: Slack/Discord notifications for backup status.
    • ๐Ÿ Python SDK: Import geminiai as a library in your own scripts.
    • ๐Ÿณ Docker Image: Official container for server deployment.
  • Phase 4 (Vision): AI-driven anomaly detection and self-healing infrastructure.

See ROADMAP.md for the full detailed vision.

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

geminiai_cli-14.0.1.tar.gz (97.5 kB view details)

Uploaded Source

Built Distribution

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

geminiai_cli-14.0.1-py3-none-any.whl (67.2 kB view details)

Uploaded Python 3

File details

Details for the file geminiai_cli-14.0.1.tar.gz.

File metadata

  • Download URL: geminiai_cli-14.0.1.tar.gz
  • Upload date:
  • Size: 97.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geminiai_cli-14.0.1.tar.gz
Algorithm Hash digest
SHA256 dea6c826045b691e42124bc57f1f7fc0e979236ad0f53b6c981411da5a3c96a2
MD5 8931fa68f65d35fa4c9802dd2b17681c
BLAKE2b-256 e7607310ae5523f56b26a56417da1456fbd14025fd5becdd6062059492abea9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for geminiai_cli-14.0.1.tar.gz:

Publisher: publish.yml on dhruv13x/geminiai-cli

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

File details

Details for the file geminiai_cli-14.0.1-py3-none-any.whl.

File metadata

  • Download URL: geminiai_cli-14.0.1-py3-none-any.whl
  • Upload date:
  • Size: 67.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geminiai_cli-14.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d37962ef1fd882f56a460e4093dd08681af64b48eeb80d06b1c6c81ca9dbd8af
MD5 4690b2fe320de0cf481737876e582a0b
BLAKE2b-256 49735700f8738374a3c331400cbaad2ff65895da0289ca7484ccc29b0a724089

See more details on using hashes here.

Provenance

The following attestation bundles were made for geminiai_cli-14.0.1-py3-none-any.whl:

Publisher: publish.yml on dhruv13x/geminiai-cli

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