xAI's Grok 4 CLI: Grok's New CLI Tool is ACTUALLY GOOD! (Opensource)

AICodeKingAbout 3 min readJul 26, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

  • Grock Kai: A CLI tool specifically designed to enhance Grok's coding capabilities.
  • Tool Calling: The ability of a language model to effectively use external tools to accomplish tasks.
  • System Prompts: Instructions given to a language model to guide its behavior and improve its performance.
  • CLI (Command Line Interface): A text-based interface for interacting with a computer.
  • API Key: A unique identifier used to authenticate requests to an API (Application Programming Interface).
  • Agentic Benchmark: A set of tests designed to evaluate the performance of AI agents.

Grock Kai: Enhancing Grok's Coding Capabilities

  • Introduction: Grok 4, while capable, was not optimal for regular tool calling, especially with AI coding tools like Cursor or Klein. Grock Kai is a new tool designed specifically to address this limitation by optimizing Grok for coding tasks.
  • Functionality: Grock Kai enables users to interact with Grok through natural language to view, create, and edit files, as well as execute shell commands. It intelligently selects the appropriate tools for each request.
  • Interface: It features a terminal interface built with Ink and can be integrated into GitHub actions and workflows. It also supports a non-interactive mode for custom scripts.
  • Customization: Users can create rules and custom instructions to tailor Grock Kai to their specific needs. However, it currently lacks custom slash commands.
  • Model Flexibility: The CLI can be used with different models by specifying the base URL and model name.

Installation and Setup

  • Installation: Grock Kai can be easily installed using the command npm install.
  • API Key Configuration: The Grok API key must be set as an environment variable using export or by adding it to the settings file (JSON format) located in the home directory.
  • Running Grock Kai: After setup, Grock Kai can be launched using the Grock command.

Using the Grock Kai Interface

  • Interface Overview: The interface is similar to Claude Code or Gemini CLI, featuring a prompt box for input.
  • Slash Commands:
    • /help: Displays help information about the tool.
    • /clear: Clears the context up to the current time.
    • /models: Shows available model options (Grok 3, Grok 4, Grok 3 Mini). Grok 4 is generally preferred.
    • /exit: Exits the Grock Kai interface.
  • Direct Terminal Commands: Commands like touch, mkdir, delete, ls, and pwd can be executed directly from the prompt box.

Example Usage: Implementing a Light Theme

  • Task: The example demonstrates implementing a simple light theme in a KingBench app.
  • Process: Grock Kai prompts the user to approve each step. The process is fast, leveraging improvements in Grok's API limits (tokens per minute, etc.).
  • Result: The task is completed successfully, with the light theme implemented correctly.

Performance and Comparison

  • Agentic Benchmark: Grock Kai passes two out of five questions on the presenter's agentic benchmark, performing similarly to Gemini and Quen.
  • Price Consideration: The presenter notes that Grok's pricing may not be ideal for all users.
  • Advantages: Grock Kai improves Grok's usability as a coder compared to using it with tools like Klein.
  • Model Flexibility: The CLI tool can be used with other models by defining the base URL and model name.

Conclusion

Grock Kai is a promising tool that enhances Grok's coding capabilities by optimizing tool calling and providing a user-friendly CLI. While Grok's pricing and performance may not be ideal for everyone, Grock Kai makes it a more viable option for coding tasks. The presenter hopes that XAI will release an official Grok CLI tool in the future, potentially with the Grok code model.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.