@kazuki-ookura/grok-cli
v1.2.0
Published
The community maintenance fork of Grok CLI. Fully updated for the latest xAI Responses API with native web/X search support.
Maintainers
Readme
🚀 Grok CLI (The Maintenance Fork)
"The original repo was broken. I needed it. So I fixed it." — Kazuki Okura
This is the community-led, high-performance maintenance fork of the original Grok CLI. Since the upstream repository (superagent-ai/grok-cli) is no longer maintained and failed to work with the latest xAI API changes, I have completely overhauled it to support the modern xAI Responses API.
🌟 Why this fork?
- ✅ Fixed & Alive: The original OpenAI SDK-based implementation is broken for latest models. This fork uses the latest
/v1/responsesAPI. - 🔍 Native Search: First-class support for
web_searchandx_searchtools. - 🧠 Grok-3 & 4-1 Ready: Optimized for the latest
grok-4-1-fast-reasoningandgrok-3models. - ⚡ Performance: Lightweight implementation with axios for maximum reliability.
🚀 Quick Start
Global Installation
Install the fixed version directly from my personal NPM scope:
# Using Bun (Recommended)
bun add -g @kazuki-ookura/grok-cli
# Using NPM
npm install -g @kazuki-ookura/grok-cliInstallation from Source (for Developers)
If you want to contribute or use the latest source code:
git clone https://github.com/kazuki-ookura/grok-cli.git
cd grok-cli
bun install
bun run build
bun link # To use 'grok' command globally from sourceUsage
# Start interactive mode
grok
# Single prompt (Headless mode)
grok -p "Explain quantum computing in one sentence"
# AI-powered Git operations
grok git help
# Manage MCP servers
grok mcp list✨ Features
- 🤖 Conversational AI: Natural language interface powered by the latest Grok models.
- 🔍 Intelligent Search: Native web and X (Twitter) search capabilities.
- 📝 Smart File Operations: AI automatically views, creates, and edits files.
- ⚡ Bash Integration: Execute shell commands through natural conversation.
- 🔌 MCP Tools: Full Model Context Protocol support (Linear, GitHub, etc.).
🛠 Configuration
Environment Variables
Set these in your shell profile (e.g., .zshrc or .bashrc):
| Variable | Description | Default |
|----------|-------------|---------|
| GROK_API_KEY | (Required) Your x.ai API key | - |
| GROK_BASE_URL | API base URL | https://api.x.ai/v1 |
| GROK_MODEL | Default model to use | grok-4-1-fast-reasoning |
CLI Options
Options:
-v, --version Output the version number
-d, --directory <dir> Set working directory
-k, --api-key <key> Grok API key
-u, --base-url <url> Grok API base URL
-m, --model <model> AI model to use (e.g., grok-3, grok-4-latest)
-p, --prompt <prompt> Process a single prompt and exit
--max-tool-rounds <n> Max number of tool execution rounds (default: 400)📈 Status & Future
The original project at superagent-ai/grok-cli appears to be abandoned. I've taken the initiative to keep this project alive because it's a fantastic tool for developers. Expect regular updates as the Grok API evolves.
Join the movement: If you find this useful, leave a star on GitHub!
📄 License
MIT License - Feel free to use, modify, and distribute.
Developed and maintained with ❤️ by Kazuki Okura.
