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 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
pushandpullbackups 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:
- User Input: Commands are parsed by
argparseincli.py. - Configuration: Settings are loaded from Env Vars and
settings.json. - Execution: The appropriate module (e.g.,
backup.py) is invoked. - Cloud Operations: If cloud flags are present,
cloud_factory.pyinstantiates the correct provider (S3orB2). - Output: Results and logs are displayed using
richfor 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.
- Check out our CONTRIBUTING.md (if available) or simply fork the repo.
- Setup Dev Environment:
git clone https://github.com/dhruv13x/geminiai-cli.git cd geminiai-cli pip install -e .[dev]
- Run Tests:
pytest tests/ - 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
geminiaias 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
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-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dea6c826045b691e42124bc57f1f7fc0e979236ad0f53b6c981411da5a3c96a2
|
|
| MD5 |
8931fa68f65d35fa4c9802dd2b17681c
|
|
| BLAKE2b-256 |
e7607310ae5523f56b26a56417da1456fbd14025fd5becdd6062059492abea9a
|
Provenance
The following attestation bundles were made for geminiai_cli-14.0.1.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-14.0.1.tar.gz -
Subject digest:
dea6c826045b691e42124bc57f1f7fc0e979236ad0f53b6c981411da5a3c96a2 - Sigstore transparency entry: 764296983
- Sigstore integration time:
-
Permalink:
dhruv13x/geminiai-cli@9244facddf78dc5e69a5a7006b00b9e818534c59 -
Branch / Tag:
refs/tags/v14.0.1 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9244facddf78dc5e69a5a7006b00b9e818534c59 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d37962ef1fd882f56a460e4093dd08681af64b48eeb80d06b1c6c81ca9dbd8af
|
|
| MD5 |
4690b2fe320de0cf481737876e582a0b
|
|
| BLAKE2b-256 |
49735700f8738374a3c331400cbaad2ff65895da0289ca7484ccc29b0a724089
|
Provenance
The following attestation bundles were made for geminiai_cli-14.0.1-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-14.0.1-py3-none-any.whl -
Subject digest:
d37962ef1fd882f56a460e4093dd08681af64b48eeb80d06b1c6c81ca9dbd8af - Sigstore transparency entry: 764296987
- Sigstore integration time:
-
Permalink:
dhruv13x/geminiai-cli@9244facddf78dc5e69a5a7006b00b9e818534c59 -
Branch / Tag:
refs/tags/v14.0.1 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9244facddf78dc5e69a5a7006b00b9e818534c59 -
Trigger Event:
push
-
Statement type: