Gemini CLI Auth Manager is a lightweight tool designed for the Google Gemini CLI environment. It supports instant multi-account switching, automatic rotation on quota exhaustion, and unified account pool management!
- Instant Switching: Switch between multiple accounts in seconds.
- Auto-Backup: Automatically saves your credentials upon switching.
- 🆕 Gemini 3.1 Series Support: Fully compatible with the latest
gemini-3.1-proandgemini-3.1-flash-litemodels. - 🆕 Intelligent Rotation Strategies:
gemini3.1-series-only(Default): Monitors all 3.1 models.gemini3.1-pro-only: Focuses exclusively on Pro model quota.custom: Supports regex-based model matching.
- Quota Pre-check: Real-time quota monitoring via Google API, auto-switches before exhaustion (Default threshold: 10%).
- Native OAuth Login: One-click browser login to officially authenticate and capture accounts directly.
- Interactive Menu: Visual configuration interface (
gchange menu). - Slash Command: Seamlessly integrated as
/changein Gemini CLI.
git clone https://github.com/Besty0728/Gemini-CLI-Auth-Manager.git
cd Gemini-CLI-Auth-Manager
python install.py- Python 3.8+
requestslibrary (pip install requests)- Gemini CLI available as
geminion your PATH
- The installer creates
~/.gemini/gchangeand links it as~/.local/bin/gchangewhen possible. - If
gchangeis not found after installation, add this to your shell profile:
export PATH="$HOME/.local/bin:$PATH"| Command | Description |
|---|---|
/change <n> |
Switch to account #n |
/change next |
Switch to the next available account |
/change menu |
Open the interactive management menu |
/change strategy |
View or change rotation strategy |
/change config |
Quick view of auto-switch configuration |
| Command | Description |
|---|---|
gchange |
List all accounts and status |
gchange <n> |
Fast switch to account #n |
gchange menu |
Open interactive menu (Recommended) |
gchange pool login |
Add a new account via OAuth |
gchange uninstall |
Uninstall this tool |
Settings are stored in ~/.gemini/auth_config.json.
| Key | Default | Description |
|---|---|---|
strategy |
gemini3.1-series-only |
conservative, gemini3.1-pro-only, gemini3.1-series-only, custom |
threshold |
10 |
Switch account when remaining quota < 10% |
model_pattern |
gemini-3.1.* |
Regex pattern for model monitoring |
auto_restart |
false |
Automatically restart CLI after a switch when the current platform can launch gemini |
~/.gemini/
├── gemini_cli_auth_manager.py # Core script
├── auth_config.json # Configuration file
├── google_accounts.json # Account index metadata
├── auth_profiles/ # Account credentials storage
│ ├── user1@gmail.com/
│ └── ...
├── hooks/
│ ├── quota_pre_check.py # BeforeAgent Hook
│ └── quota_auto_switch.py # AfterAgent Hook
└── commands/
└── change.toml # Slash command config
- 🗑 New: One-click uninstall via
gchange uninstall [--force] [--keep-accounts]andpython install.py --uninstall. - 🛠 Fix:
gchangenow works immediately after install — no terminal restart needed. - 🛠 Fix: Uninstall no longer touches PATH to avoid breaking Gemini CLI's own entries.
- 🛠 Fix: Corrected the directory name in the installation instructions (
cd Gemini-CLI-Auth-Manager) so the steps work on case-sensitive systems like Linux and macOS. (Thanks @getbot887, closes #5)
- 🌍 Cross-Platform: Added Linux and macOS compatibility — Unix launcher, dynamic platform detection,
sys.executablefor subprocess calls. (Thanks @bincat233) - 🛠 Fix: Handle quoted combined commands like
'pool login'correctly. (Thanks @victorinfinops) - 🛠 Fix:
auto_restartconfig key can now be set viagchange config.
- ✨ Enhancement: Fully updated UI and internal logic to version 2.3.
- ✨ Optimization: Improved response speed and accuracy of quota monitoring.
- 🛠 Fix: Resolved several residual references and display issues from v2.2.
- 🚀 Installer: Upgraded installer for more reliable hook configurations.
- 🆕 Gemini 3.1 Support: Added auto-rotation support for
gemini-3.1-proandgemini-3.1-flash-lite. - 🆕 Smart Strategies: Introduced rotation strategies like
gemini3.1-series-only. - ⚡ Auto-Rotation: Implemented automatic account switching based on quota pre-checks.
One-command cleanup removes all installed files:
# Interactive uninstall (shows what will be removed, asks for confirmation)
gchange uninstall
# Skip confirmation
gchange uninstall --force
# Keep account data (profiles + tracking)
gchange uninstall --keep-accountsAlternatively, run from the source directory:
python install.py --uninstallWhat gets removed:
- Core script, CLI launcher, slash command, hook scripts, config file
- Auto-switch hooks from
settings.json(other settings preserved) GEMINI_FORCE_FILE_STORAGEenvironment variable- Account data (profiles + tracking) — unless
--keep-accountsis used
PATH entries are intentionally left untouched, as
~/.geminimay be shared with Gemini CLI itself.
Developed by Besty. Feel free to submit Issues or PRs!