Grok CLI
Open-source terminal coding agent for the xAI Grok API.
Best for
Developers and power users who live in the terminal, especially if you want to keep your key on your own device and pay nothing for the software.
Skip it if
You need offline or local models or you use a provider other than xAI or OpenAI-compatible.
Rank in Command Line
27th of 29 by editor score
Key Safety
77/100 (grade B), safer than 7% of its category
Overview
Grok CLI is an open-source conversational coding agent that runs in your terminal on your own xAI key. It can read and edit files, run shell commands and use MCP tools, and also works with other OpenAI-compatible endpoints.
Key features
- File editing
- Shell commands
- MCP tools
- Custom instructions per project
Works with these providers
2 provider options, fewer than the 6.6 average for command line. Usage is billed by the provider at its list price.
Our verdict
Grok CLI is ranked 27th of 29 command line on BYOK Tools and trails its category on key safety. Its standout strength: lightweight. The main trade-off: narrow provider focus.
What we like
- Lightweight
- Made for Grok models
Watch out for
- Narrow provider focus
How Grok CLI compares
Against the highest-rated command line on BYOK Tools. Scores are out of 5 (editor) and 100 (Key Safety).
| Tool | Editor score | Key Safety | Pricing | Providers | Open source | Local models | Key stays local |
|---|---|---|---|---|---|---|---|
| Grok CLI | 3.8 | 77 | Open source | 2 | – | ||
| LLM (Simon Willison) | 4.6 | 93 | Open source | 13 | |||
| Fabric | 4.5 | 93 | Open source | 14 | |||
| AIChat | 4.4 | 93 | Open source | 15 | |||
| Gemini CLI | 4.4 | 75 | Open source | 1 | – |
- Prioritising key safety? LLM (Simon Willison) scores 93/100.
How to use Grok CLI with your own API key
- 1
Create an API key
Get a key from your provider's console: xAI. Create a separate key just for Grok CLI so you can revoke it on its own.
- 2
Set a spending limit
Set a monthly budget or usage cap in the provider dashboard before you start. It is the simplest protection against a leaked key or a runaway agent.
- 3
Install Grok CLI
Install Grok CLI from the command line using the instructions in its repository or docs.
- 4
Add your key
Paste the key into Grok CLI's provider or model settings. Your key is stored on your device and requests go directly to the provider.
What it costs to run Grok CLI
Pricing for Grok CLI itself: Open source (Free & open source). Model usage is billed by your provider. Estimated monthly API spend by usage level, using live list prices:
| Model | Light~5 messages a day | Regular~20 messages a day | Heavy~80 messages a day |
|---|---|---|---|
| Grok 4.7xAI · Flagship | $0.46 | $3.80 | $49 |
Estimates assume typical chat-length messages with conversation history and no prompt caching. Prices from OpenRouter's public models API. Run your own numbers.
BYOK Key Safety Score
Key handling in Grok CLI
Grade B
Your key is stored on your device and requests go directly to the provider.
Category average: 88/100
- Key storage40/40
Key stays on your device; requests go direct to the provider.
- Auditable code25/25
Open source: anyone can verify how keys are handled.
- Self-hosting8/15
Runs as a local app, but not as a self-hosted service.
- Offline option0/10
Cloud providers only.
- Provider choice4/10
2 provider options, which lets you pick the provider whose data terms you trust.
Whatever the score, give each app its own key, set a monthly spend limit with your provider, and revoke keys you no longer use. Read the key-safety checklist.
Grok CLI FAQ
- Does Grok CLI support bring your own key?
- Yes. Grok CLI accepts your own API key from xAI and OpenAI-compatible. Usage is billed by the provider at its API rates.
- Where does Grok CLI store my API key?
- On your device. Requests go directly from Grok CLI to the provider. Its BYOK Tools Key Safety Score is 77/100.
- Is Grok CLI free?
- Open source: Free & open source. API usage is billed separately by your model provider.
- How much does it cost to use Grok CLI with my own API key?
- For regular use (about 20 messages a day), API costs run from roughly $3.80 to $3.80 a month depending on the model, based on current list prices.
- Is Grok CLI open source?
- Yes. The source code is at https://github.com/superagent-ai/grok-cli.
- Can Grok CLI run local models?
- No. Grok CLI works with cloud providers only.
- Which platforms does Grok CLI support?
- CLI, macOS, Windows, Linux.
- What are the best alternatives to Grok CLI?
- Popular alternatives include LLM (Simon Willison), AIChat, mini-swe-agent and kubectl-ai. See the comparison table above for pricing, providers and key safety side by side.
Community reviews
No reviews yet.
Alternatives to Grok CLI
All command line →LLM (Simon Willison)
Command Line
CLI and Python library for interacting with any LLM.
AIChat
Command Line
All-in-one LLM CLI with chat REPL, RAG, agents and a local server.
mini-swe-agent
Command Line
The 100-line agent that solves GitHub issues or helps in your terminal.
kubectl-ai
Command Line
AI-powered Kubernetes assistant that runs in your terminal.
Lumen
Command Line
Beautiful git diff viewer that writes commit messages and explains changes with AI.
Fabric
Command Line
Open-source framework of crowdsourced AI prompts for the CLI.