The silent page awaits the waking dawn.
~/.grok/auth.json # The current active Grok session
~/.grok-switch/
sequence.json # Account index, rotation order, statistics
accounts/<n>/auth.json # A backup of each account
dir-accounts.json # Optional path-to-account mapping
isolated/ # Isolated home used by gas exec
curl -fsSL https://raw.githubusercontent.com/pintaste/gas/main/install.sh | bash
export PATH="${HOME}/.local/bin:${PATH}"
command -v gas && gas version # Expected output: gas 0.1.0
gas (Grok Account Switch) is an open-source command-line tool for managing multiple Grok CLI logins on the same machine. Grok writes the current session to ~/.grok/auth.json; gas snapshots that file into numbered accounts and lets you switch with a single command—work account, personal account, experimental account—no more repeated logout / login.
Repo: github.com/pintaste/gas (MIT). Inspired by ccs / cc-account-switcher on the Claude Code side.
Why I Built This Tool
The reason is specific: I use Grok for both personal projects and everyday agent sessions, and I have more than one account. Grok CLI pins the session to that single file at ~/.grok/auth.json—to switch accounts, you have to logout and then login, go through device authorization in the browser, and you risk messing up running sessions along the way.
Claude Code already has ccs, a local multi-account switcher with a clean philosophy: don't meddle with login, just manage "which credentials are active." Grok had no equivalent tool at the time, so I built gas following the same product pattern.
I deliberately kept the scope tight:
I built it together with Grok, then added tests and an install script. For me it's first and foremost a tool that solves my own pain point; open-sourcing it is a hope that other people juggling multiple Grok CLI accounts won't have to reinvent the wheel.
Why You Need It
Grok CLI only maintains one "current login" by default. Multi-account scenarios are common:
Manually switching accounts is costly: log out → log back in → switch again. gas turns that into:
Grok hot-reloads auth.json, so in most cases you don't need to restart the TUI after switching.
What It Does and Doesn't Do
Does:
Doesn't do:
The command name is gas, not gss. Many shells treat gss as an alias for git status -s.
How It Works (Simplified)
Directory responsibilities are roughly as follows:
Each time you switch, gas does:
In other words: switching is a local file operation of "back up current → restore target," no third parties involved.
Installation
Requires Python 3.9+. Grok CLI is only needed when you log in; gas itself doesn't depend on it to run.
Or from source:
Installed by default to ~/.local/bin/gas, make sure that directory is in your PATH. Minimum acceptance test for coding agents:
Do not print or commit token files from ~/.grok/ or ~/.grok-switch/. Archives are session credentials.
Quick Start
Give accounts memorable names:
Command Reference
Old aliases still work: gas save, gas use, gas list.
Advanced: Auto-Switch by Project, Parallel Sessions Without Conflicts
Directory mapping is ideal for "use the work account when you enter this repo":
Isolated execution is suited for agent/CI/parallel tasks—it doesn't touch the global auth.json:
Environment Variables (optional):
Security & Uninstallation
Tests use a temporary directory and won't touch real accounts:
FAQ
What's the difference between gas and editing auth.json directly?
Editing the file directly has no indexing, no locking, no rollback. gas maintains numbered archives, rotation order, failure rollback, and exec isolated paths—designed for daily back-and-forth switching.
Grok didn't switch accounts after using gas?
First run gas whoami / gas status to check if the live email changed. In rare cases you may need to restart the TUI; the docs note that Grok usually hot-reloads auth.json.
Prompt says "current login not managed"?
You just ran grok login into a new session but haven't run gas add yet. Capture it first, then switch.
Can this be used with coding agents?
Yes. The install path is fixed at ~/.local/bin/gas; for parallel tasks, prefer gas exec <id> -- ... to prevent multiple agents from fighting over the same live auth.json.
How does this relate to ccs?
The product shapes are similar: both are "local multi-account switchers." ccs targets Claude Code, gas targets Grok CLI; they're independent of each other.
Summary
If you already use Grok CLI with multiple accounts, gas condenses "log out then log back in" into a few local commands, plus directory mapping and isolated execution. One curl to install, run gas add twice, then jump with gas to, and that's usually enough.