pi-grok-cli
v0.1.6
Published
Use Grok CLI's API endpoint in pi.
Maintainers
Readme
pi-grok-cli
A pi extension that connects to Grok CLI's API endpoint.
The Grok CLI has access to models not available on the public api.x.ai API yet:
| Model | Public API (api.x.ai) | Grok CLI |
|---|---|---|
| grok-composer-2.5-fast | ❌ | ✅ |
| grok-build | ✅ | ✅ |
| grok-4.3 | ✅ | ✅ |
grok-composer-2.5-fast is Cursor's Composer 2.5 model, a purpose-built agentic coding model optimized for long-horizon coding tasks.
Cursor Tool Compatibility
Grok CLI models are trained to use Cursor-style coding tools. This extension includes compatibility shims so those models can keep using familiar tool calls inside pi:
- File tools:
Read,Write,StrReplace,Edit,Delete, andLS - Search tools:
GrepandGlob - Web search:
WebSearchonly when pi-web-access is installed (pi install npm:pi-web-access); it delegates to that extension’sweb_search - Terminal tool:
Shell
When the active model is grok-cli and pi-web-access is installed, web_search is removed from the active tool set and blocked if invoked; use WebSearch instead. If pi-web-access is not installed, WebSearch is not registered and nothing changes for web search. Other providers keep using web_search from pi-web-access when that extension is installed.
The shims also normalize common Cursor/Grok argument shapes, such as contents for writes, glob_pattern for file search, glob_filter for grep filters, and old_string/new_string or oldText/newText for exact replacements. This keeps agentic coding workflows moving instead of failing on tool schema mismatches.
Requirements
You need an active Grok subscription or an X Premium subscription with Grok access to use this extension.
Installation
pi install npm:pi-grok-cliFor local development from this checkout:
pi install ./pi-grok-cli
# or run once without installing
pi -e ./pi-grok-cliUsage
Login
/loginSelect "Grok CLI" from the provider list. This opens the xAI OAuth page in your browser.
Select a model
/model grok-cli/grok-composer-2.5-fastCheck usage
/grok-cli-usageEnvironment Variables
| Variable | Default | Description |
|---|---|---|
| PI_GROK_CLI_BASE_URL | https://cli-chat-proxy.grok.com/v1 | Override API base URL |
| PI_GROK_CLI_MODELS | (all models) | Comma-separated model IDs to expose |
| PI_GROK_CLI_OAUTH_CLIENT_ID | b1a00492-... | Override OAuth client ID |
| PI_GROK_CLI_OAUTH_SCOPE | openid profile email offline_access grok-cli:access api:access | Override OAuth scopes |
| GROK_CLI_OAUTH_TOKEN | — | Direct token bypass that skips OAuth entirely. No automatic refresh or renewal is performed; provide a valid external access token and replace or rotate it when it expires. |
