Zero dependencies. 10+ API endpoints. One CLI.

AI from your
terminal.

Chat, search the web, generate images and videos, analyze vision, get embeddings — all through the xAI Grok API, from a single CLI with zero dependencies.

View on GitHub
grok
$ _

Everything the API offers,
in one command

Eight capabilities. Zero dependencies. Install and go.

Chat & Streaming

Real-time streaming, system messages, temperature control. Pipe stdin for code review.

Web & X Search

Search the web or X/Twitter via the Responses API. Grounded answers with citations.

Video Generation

Text-to-video, image-to-video, video editing. Async polling with auto-download.

Image Generation

Generate images with standard or pro models. Save to file with -o.

Vision Analysis

Analyze local images or URLs. Ask questions about what you see. Multimodal chat.

Structured Output

Constrain responses to JSON schemas. Parse-friendly output for automation pipelines.

Zero Dependencies

Only Node.js built-in fetch(). No SDK, no framework, no bloat.

Pipe-Friendly

Stdout-first. Pipe files in, chain outputs, use with jq, build scripts.

Full API coverage

Every xAI endpoint mapped to a simple command or flag.

Feature Command / Flag Endpoint
Chat grok chat /v1/chat/completions
Streaming --stream /v1/chat/completions (SSE)
Web search grok search / --search /v1/responses
X search grok xsearch / --xsearch /v1/responses
Image gen grok image /v1/images/generations
Video gen grok video /v1/videos/generations
Vision grok vision /v1/chat/completions
Embeddings grok embed /v1/embeddings
Models grok models /v1/models
Structured output --response-format /v1/chat/completions
Deferred --deferred /v1/chat/completions + polling
System messages --system All chat/search endpoints

Commands & flags

Nine commands. Fifteen flags. Infinite pipelines.

Command Description
grok chat Chat with any Grok model
grok search Web search via Responses API
grok xsearch X/Twitter search via Responses API
grok image Generate images (standard or pro)
grok video Generate videos with polling & download
grok vision Analyze images (local file or URL)
grok embed Generate text embeddings
grok models List available models
grok auth Manage API key (show / set / check)
--model, -m

Model selection

--stream, -s

Stream response tokens

--temperature, -t

Sampling temperature (0-2)

--max-tokens

Max response tokens

--json

Raw API JSON output

--system

System message / instructions

--search / --xsearch

Enable web or X search

--deferred

Async completion with polling

--response-format

Constrain output format (JSON)

--pro

Pro image model

--duration

Video duration (1-15s)

--image / --video-url

Source media for video gen

--no-poll

Return request_id only

--output, -o

Save to file

--api-key / --file

Override key / read from file

Get started in 30 seconds

One install. Set your key. Start prompting.

# Install globally
$ npm install -g grok-terminal
# Set your API key
$ grok auth set xai-your-key
# Chat
$ grok chat "explain quantum computing"
# Search the web
$ grok search "latest AI news"
# Generate an image
$ grok image "a cat in space" -o cat.png