Chat with Grok from the terminal using your existing SuperGrok or X Premium+ account
Generate, edit, and extend images and videos with xAI from a shell script
Run text-to-speech and streaming speech-to-text over WebSocket
Wire grok-cli into AI agents like Cursor or Claude Code through a bundled npx skill
OAuth login uses an existing SuperGrok or X Premium+ account, so no separate paid API key is needed.
grok-cli is a command-line tool, written in Rust, for talking to Grok and the xAI service from a terminal window instead of a web browser. The key idea is that you sign in once with your existing SuperGrok or X Premium+ account using OAuth (an in-browser login flow), so you do not need a separate paid API key. The tool gathers many xAI features behind a single, flat command surface. There are commands for login and session management (login, status, refresh, logout, state), a chat command that streams readable answers by default (with web search included), and a search command that queries X posts. There are also generation commands for images (image, image-edit), videos (video, video-edit, video-extend), text-to-speech (tts), and speech-to-text (stt and stt-stream over WebSocket, marked experimental). A usage command shows your local session totals and recent rate-limit snapshots. The authors target three kinds of users in the README. Humans get streaming text answers and simple positional arguments. Scripts can pass --json to get a stable, non-streaming envelope of the form {ok, command, data} or {ok, command, error}. AI agents (Codex, Claude Code, Cursor, OpenClaw, Hermes Agent, and similar runtimes) can install a bundled skill via npx so the assistant handles install checks, OAuth login, and command routing. Installation is offered three ways: install the skill, build from source with cargo (Rust 1.88 or newer, repository pinned to 1.92.0), or download a prebuilt binary for macOS Apple Silicon or Windows x64. Local state lives under ~/.grok-cli, with OAuth tokens in auth.json and usage history in a SQLite file. Media file bodies are not stored in SQLite.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.