explaingit

blockedpath/pi-xai-oauth

11TypeScript

TLDR

pi-xai-oauth is a plug-in for a CLI tool called pi that adds xAI's Grok model as a provider you can talk to from the command line.

Mindmap

A visual breakdown will appear here once this repo is fully enriched.

In plain English

pi-xai-oauth is a plug-in for a CLI tool called pi that adds xAI's Grok model as a provider you can talk to from the command line. The point of the package is that you log into xAI with its real OAuth flow, the same one the official Grok CLI uses, instead of having to copy and paste an API key. Once installed it makes Grok 4.3 (and a couple of older Grok 4.2 variants) available as the default model, with a 1 million token context window and three reasoning depth levels: low, medium, and high. The one-line install is npx pi-xai-oauth, which runs a setup script that installs the package into pi, sets xai-auth as the default provider, sets grok-4.3 as the default model, and turns on high thinking by default. There is also a manual route: pi install npm:pi-xai-oauth followed by editing ~/.pi/agent/settings.json to set the defaults yourself. The How It Works section describes the OAuth dance. Running pi /login xai-auth starts a local HTTP server on 127.0.0.1, builds an xAI authorize URL with a PKCE challenge, opens your default browser to xAI's login page, catches the redirect after you approve, and exchanges the code for access and refresh tokens. Refresh tokens are stored and rotated automatically before they expire. The plug-in also detects existing Grok CLI credentials at ~/.grok/auth.json and offers to reuse them. If localhost callbacks are blocked (for example on a VPN, inside Docker, or over SSH), the terminal UI shows a text field where you paste the redirect URL by hand. On top of the OAuth provider, the package registers five custom tools that call the xAI API directly: xai_generate_text for plain text generation with reasoning, xai_multi_agent for deep multi-agent research with a configurable number of agents, xai_web_search for web search, xai_x_search for X (Twitter) search, and xai_code_execution for asking Grok to analyse or simulate Python code. The README is clear that these count against your SuperGrok rate limits. Usage is straightforward once authenticated: pi "some prompt", or pi --model grok-4.3 "prompt", and you can pick reasoning depth inline with a syntax like grok-4.3:high. A quick reference table summarises commands for install, update, remove, login, and listing packages.

Open on GitHub → Explain another repo

Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.