Grok CLI Manual

What Is Grok CLI

Grok CLI is a terminal coding agent that can understand a repository, edit files, run commands, and complete multi-step tasks.

Grok CLI, also presented as Grok Build in its interface, is xAI's terminal coding agent. It can inspect a project, edit files, run commands, search for information, and retain conversation context.

Three common modes

ModeCommandBest for
Interactive UIgrokDay-to-day development with visible progress
Single requestgrok -p "..."Scripts, CI, or tasks that need only a final result
Resumegrok --continueContinuing the latest session for the current project

Good uses

  • Explain an unfamiliar repository, locate bugs, edit code, and add tests.
  • Review diffs, diagnose build failures, and update documentation.
  • Try changes in a separate worktree without disturbing the current checkout.
  • Return JSON or JSON Schema-constrained output for another program.

Request path on this site

Grok CLI / Responses / Images / Videos API
                 ↓
              XSI Router
                 ↓
      Official xAI API (API key)

The CLI still runs inside your local project. XSI Router authenticates, routes, and forwards model, image, and video requests to the official xAI API. Model inference and Imagine tools read different base URLs; see Image Generation and Editing and Video Generation for the complete configuration.