pi-grok-cli

Use Grok CLI's API endpoint in pi.

Packages

Package details

extension

Install pi-grok-cli from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-grok-cli
Package
pi-grok-cli
Version
0.1.2
Published
Jun 2, 2026
Downloads
not available
Author
kenryu
License
MIT
Types
extension
Size
90.8 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-grok-cli

CI Version License: MIT

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, and LS
  • Search tools: Grep and Glob
  • Terminal tool: Shell

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-cli

For local development from this checkout:

pi install ./pi-grok-cli
# or run once without installing
pi -e ./pi-grok-cli

Usage

Login

/login

Select "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-fast

Check quota status

/grok-cli-status

Environment 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.