git404hub

what is pi-xai-oauth fr?

blockedpath/pi-xai-oauth — explained in plain English

Analysis updated 2026-05-18

11TypeScriptAudience · developerComplexity · 2/5Setup · easy

tl;dr

A plug-in for the pi CLI that adds xAI Grok as a provider using xAI's real OAuth flow, so you log in via browser instead of pasting an API key.

vibe map

mindmap
  root((pi-xai-oauth))
    Inputs
      pi prompt
      OAuth browser login
    Outputs
      Grok responses
      Refreshed tokens
      Tool call results
    Use Cases
      Use Grok from terminal
      Multi-agent research
      Web and X search
    Tech Stack
      TypeScript
      Node
      OAuth PKCE
      xAI API
      pi CLI

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Add Grok 4.3 as your default pi CLI model with one npx install command

VIBE 2

Log into xAI with OAuth and PKCE instead of managing an API key file

VIBE 3

Call xai_multi_agent or xai_web_search as tools from a pi session

VIBE 4

Reuse existing Grok CLI credentials at ~/.grok/auth.json to skip a fresh login

what's the stack?

TypeScriptNodeOAuthpi

how it stacks up fr

blockedpath/pi-xai-oauthaliyun/openclaw-exporter-to-langfuseanousss007/ng-blatui
Stars111111
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderatemoderate
Complexity2/54/53/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 5min

Needs the pi CLI installed plus an active SuperGrok account, tool calls count against your xAI rate limits.

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.

prompts (copy fr)

prompt 1
Walk me through the one-line npx pi-xai-oauth install and what it changes in ~/.pi/agent/settings.json
prompt 2
Explain the OAuth PKCE flow pi-xai-oauth uses when localhost callbacks are blocked over SSH
prompt 3
Write a pi command that runs grok-4.3 with high reasoning depth on a custom prompt
prompt 4
Compare the five xai_* tools and pick the right one for analysing Python code with Grok

Frequently asked questions

what is pi-xai-oauth fr?

A plug-in for the pi CLI that adds xAI Grok as a provider using xAI's real OAuth flow, so you log in via browser instead of pasting an API key.

What language is pi-xai-oauth written in?

Mainly TypeScript. The stack also includes TypeScript, Node, OAuth.

How hard is pi-xai-oauth to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is pi-xai-oauth for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.