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
| Mode | Command | Best for |
|---|---|---|
| Interactive UI | grok | Day-to-day development with visible progress |
| Single request | grok -p "..." | Scripts, CI, or tasks that need only a final result |
| Resume | grok --continue | Continuing 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 API
↓
YAI Router (yai)
↓
grok-cloud
↓
Grok upstream serviceThe CLI still runs inside your local project. YAI Router and grok-cloud handle model-request authentication, routing, protocol conversion, and upstream session maintenance.