A slick, cross-platform GUI for managing and rapidly switching between API key profiles. Designed for developers working with Google Cloud, Gemini, and other services who are tired of juggling environment variables.
- Seamless Profile Switching: Create, edit, and switch between different
gcloudaccounts, projects, and API keys in seconds. - Cross-Platform Persistence:
- Windows: Securely saves environment variables to the Registry (
HKCU/HKLM) and uses a PowerShell wrapper to inject settings into your current terminal session. - POSIX (Linux/macOS): Automatically configures your
.bashrc,.zshrc, or.profileto source a dedicated environment file.
- Windows: Securely saves environment variables to the Registry (
- Isolated
gcloudContext: Allgcloudcommands are run with a sandboxedCLOUDSDK_CONFIGto prevent conflicts between user and administrator profiles. - Intelligent
gcloudIntegration:- Auto-detects
gcloudinstallation. - Resolves project IDs and numbers.
- Manages
gcloudconfigurations for each profile.
- Auto-detects
- Deep Clean: A "Purge" function to surgically remove
gcloudauthentication caches (ADC,legacy_credentials, databases) when you need a fresh start.
The correct way to launch APISwitch depends on your operating system. Following these instructions is critical for the application to correctly modify your environment.
On Windows, you must use the apiswitch.ps1 wrapper script. This is essential for applying environment variables back to the terminal session you launched it from.
- Open a PowerShell terminal.
- Navigate to the project directory:
cd C:\path\to\apiswitch
- Execute the PowerShell script:
.\apiswitch.ps1
Warning: Do NOT run
python apiswitch.pydirectly in PowerShell orcmd. Bypassing the wrapper script will prevent it from updating your current session's environment variables upon closing.
On POSIX-based systems, you can run the Python script directly.
- Open your preferred terminal.
- Navigate to the project directory.
- Run the script:
python3 apiswitch.py
On the first run, the script will configure your shell's startup file (e.g., ~/.zshrc, ~/.bashrc) to source the APISwitch environment. You may need to open a new terminal window or manually source your config (source ~/.zshrc) for the changes to take effect.
APISwitch is designed to run with standard user privileges for maximum security.
It will only request Administrator elevation (via a UAC prompt) if you explicitly check the "Machine-wide env vars" option when applying a profile. This ensures that elevated rights are only used when absolutely necessary, preventing accidental changes to the system.