Sign out of Grok Build
Sign out of Grok Build
/logout signs out of the current Grok Build account in the TUI. From the shell, grok logout signs out and clears cached credentials. Official: Modes and Commands, CLI Reference.
From the TUI
- Open a Grok Build session.
- Type
/logoutand send. - Confirm you are signed out (welcome / login prompts return on the next start).
/logout
From the shell
grok logout
That clears the cached session on this machine. Next interactive start runs browser OIDC again (grok login), or you can use device-code login on headless hosts — see Log in to Grok Build with device code.
When to use which path
| Goal | Use |
|---|---|
| Leave this TUI session’s account | /logout |
| Clear credentials on this machine | grok logout |
| Sign in again locally | grok login |
| Sign in over SSH / no browser | grok login --device-auth |
| CI / scripts without OIDC | XAI_API_KEY (does not refresh like OIDC) |
Pitfalls
- API-key auth (
XAI_API_KEY) is separate from the OIDC cache — logging out OIDC does not erase an exported API key in your shell profile. - Signing out does not delete sessions under
~/.grok/sessions/— usegrok sessions deletewhen you need that.