Gemini AI CLI Tool for automation
Project description
Gemini AI Automation Tool
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
- Python: 3.8 or higher
- Optional: AWS CLI or Backblaze B2 CLI for credentials management.
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 account dashboard
geminiai cooldown --cloud
# 5. Get a smart account recommendation
geminiai recommend
✨ Features
Core Capabilities
- 🛡️ God Level Backups: Securely backup your configuration and chat history to Local, AWS S3, or Backblaze B2 storage. Supports GPG Encryption for sensitive data.
- 🌍 Machine-Time Adaptive: Automatically detects and uses your system's local timezone for all calculations and displays. No more manual IST/UTC conversions.
- ☁️ Unified Cloud Sync: Seamlessly
pushandpullbackups between your local machine and the cloud.
Smart Automation
- ⏱️ Smart Session Tracking: Tracks "First Used" timestamps to accurately predict Gemini's 24-hour rolling quota resets.
- 🧠 Intelligent Rotation: Automatically recommends the "healthiest" account based on session start times and Least Recently Used (LRU) logic.
- 🛡️ Accident Protection: Safeguards your session data by preventing accidental account switches from resetting your 24-hour quota clock.
Diagnostics & Management
- 📊 Visual Analytics: View beautiful, terminal-based bar charts of your usage history and account health.
- 🩺 Doctor Mode: Built-in diagnostic tool to validate your environment, dependencies, and configuration health.
- 🧹 Auto-Pruning: Automatically cleans up old backups and temporary files to keep your storage efficient.
🛠️ 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 |
Key CLI Arguments
| Command | Flag | Description |
|---|---|---|
backup |
--encrypt |
Encrypt the backup archive using GPG. |
restore |
--auto |
Automatically select and restore the latest backup for the best available account. |
prune |
--cloud-only |
Only remove old backups from cloud storage, keeping local copies. |
config |
--force |
Force overwrite existing configuration values. |
cooldown |
--reset-all |
DANGER: Wipe all cooldown data (local and cloud). |
🏗️ 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 & Session logs)
├── cooldown.py # ❄️ Master Dashboard & Adaptive Time Logic
├── recommend.py # 🧠 Recommendation Engine (Session-aware)
├── sync.py # 🔄 Unified Sync (Push/Pull)
├── cloud_factory.py # ☁️ Cloud Provider Abstract Factory
└── stats.py # 📊 Visualization Module
Data Flow
- User Input: CLI args are parsed by
args.pyand routed bycli.py. - Configuration: Settings are loaded from
settings_cli.py(merging Env, CLI, and Config). - Action:
- Backup: Compresses
~/.gemini, encrypts (optional), and uploads viaCloudFactory. - Restore: Fetches list from cloud/local, decrypts, and extracts to
~/.gemini. - Recommendation: Queries
cooldown.pyfor account status and selects the LRU "Ready" account.
- Backup: Compresses
- Persistence: Usage stats and cooldowns are saved to JSON files in
~/.geminiai-cli.
🐞 Troubleshooting
| Error Message | Possible Cause | Solution |
|---|---|---|
ModuleNotFoundError: No module named 'geminiai_cli' |
Installation issue. | Run pip install -e . or ensure you are in the correct venv. |
gpg: decryption failed: No secret key |
Missing GPG key or wrong password. | Ensure GEMINI_BACKUP_PASSWORD is set or the GPG key is imported. |
ClientError: An error occurred (403) ... |
AWS/B2 Credentials invalid. | Check your GEMINI_* env vars or ~/.aws/credentials. |
Permission denied: '~/.gemini' |
File permission issues. | Run chown -R $USER ~/.gemini or check directory permissions. |
Debug Mode: Currently, you can increase verbosity by inspecting the logs or running with standard python tracebacks enabled (default).
🤝 Contributing
We welcome contributions! Whether it's reporting a bug, suggesting a feature, or writing code.
See CONTRIBUTING.md for detailed instructions.
- Setup Dev Environment:
pip install -e .[dev] - Run Tests:
pytest tests/ - Submit PR: Follow the guidelines in the contributing guide.
🗺️ Roadmap
- Phase 1 (Completed): Core Backup/Restore, Multi-Cloud (S3/B2), Sync, Auto-Updates.
- Phase 2 (Completed): Machine-Time Adaptation, Session Tracking, Smart Rotation.
- Phase 3 (Upcoming):
- 🔔 Webhooks: Slack/Discord notifications for backup status.
- 🐍 Python SDK: Import
geminiaias a library in your own scripts.
- Phase 4 (Vision): AI-driven anomaly detection and self-healing infrastructure.
See ROADMAP.md for the full detailed vision.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geminiai_cli-16.0.0.tar.gz.
File metadata
- Download URL: geminiai_cli-16.0.0.tar.gz
- Upload date:
- Size: 98.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1896a1fbea713eb36b33ba102fce54be473718eb6ad31d554b1a4c395e61103b
|
|
| MD5 |
d5fff5eeef73ff150fd6ab3216484e26
|
|
| BLAKE2b-256 |
e245bedfc833af39cf65f16c7b11aa79bdb66b3e538caae28930a0a104e62f00
|
Provenance
The following attestation bundles were made for geminiai_cli-16.0.0.tar.gz:
Publisher:
publish.yml on dhruv13x/geminiai-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geminiai_cli-16.0.0.tar.gz -
Subject digest:
1896a1fbea713eb36b33ba102fce54be473718eb6ad31d554b1a4c395e61103b - Sigstore transparency entry: 772529566
- Sigstore integration time:
-
Permalink:
dhruv13x/geminiai-cli@20d2c37f63c0ee5d599cf9745be46004e923d160 -
Branch / Tag:
refs/tags/v16.0.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@20d2c37f63c0ee5d599cf9745be46004e923d160 -
Trigger Event:
push
-
Statement type:
File details
Details for the file geminiai_cli-16.0.0-py3-none-any.whl.
File metadata
- Download URL: geminiai_cli-16.0.0-py3-none-any.whl
- Upload date:
- Size: 68.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afa3aca71f18892dee44cb3471a1abcdd7fe54a38722b8b593f57dce3fb00d28
|
|
| MD5 |
1986424cdf593584d02498fa4cb1cb82
|
|
| BLAKE2b-256 |
251f83eb96c047fca980bdfde313c828eb48b50626f8b130f9035cda06eddde5
|
Provenance
The following attestation bundles were made for geminiai_cli-16.0.0-py3-none-any.whl:
Publisher:
publish.yml on dhruv13x/geminiai-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geminiai_cli-16.0.0-py3-none-any.whl -
Subject digest:
afa3aca71f18892dee44cb3471a1abcdd7fe54a38722b8b593f57dce3fb00d28 - Sigstore transparency entry: 772529569
- Sigstore integration time:
-
Permalink:
dhruv13x/geminiai-cli@20d2c37f63c0ee5d599cf9745be46004e923d160 -
Branch / Tag:
refs/tags/v16.0.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@20d2c37f63c0ee5d599cf9745be46004e923d160 -
Trigger Event:
push
-
Statement type: