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.
  • Extend it with plugins, skills, and MCP servers, review all sessions with grok dashboard, or connect it to other apps through the Agent Client Protocol (ACP).

Request path on this site

Grok CLI / Responses / Images / Videos API
                 ↓
            XAI Router (yai)
                 ↓
              grok-cloud
                 ↓
         Grok chat / Imagine upstream

The CLI still runs inside your local project. XAI Router and grok-cloud authenticate, route, and forward model, image, and video requests; they also provide the protocol conversion and upstream session handling required by model inference. Model inference and Imagine tools read different base URLs; see Image Generation and Editing and Video Generation for the complete configuration.