oh-my-pi-plugin-grok-build
v0.2.2
Published
oh-my-pi extension: xAI Grok Build subscription provider (OAuth login, model discovery, Chat Completions streaming)
Maintainers
Readme
oh-my-pi-plugin-grok-build
Standalone oh-my-pi extension for the xAI Grok Build subscription provider. It adds OAuth login, curated and live model discovery, and OpenAI Chat Completions streaming with the request identity expected by Grok Build.
Install
Install the npm package:
omp plugin install oh-my-pi-plugin-grok-buildInstall with github:
omp plugin install https://github.com/metaphorics/oh-my-pi-plugin-grok-buildLink a local checkout:
omp plugin link /path/to/oh-my-pi-plugin-grok-buildLoad the extension source for one invocation:
omp -e /path/to/oh-my-pi-plugin-grok-build/src/index.tsLogin
- Start
ompwith the extension installed or loaded. - Run
/login. - Select xAI Grok Build.
- Complete the browser PKCE flow using the opened browser or copyable authorization URL.
- If the local browser callback cannot complete (for example, on a remote or headless host), paste the full redirect URL or the authorization code from xAI; it is exchanged as an authorization code over the same PKCE flow, never as a refresh token.
Credentials are stored and refreshed through omp's normal OAuth credential store.
Multiple accounts
Run /login again and complete the flow with a different xAI account to add another. Accounts are keyed by the OAuth subject (sub): logging into the same account replaces its tokens; a different account is stored alongside.
Account selection and quota ranking are host-owned; this extension deliberately adds no plugin-side balancer. Each omp session sticks to one account via a consistent hash of the session id; without a session, selection round-robins. On 401 or usage-limit 429, the host retries by re-minting the same account's token, then switches the session to a sibling account automatically. Token refresh preserves account identity.
Models
The offline seed contains:
grok-4.6: text and image input, 500k context, low through xhigh reasoning effort.grok-4.5: text and image input, 500k context, reasoning effort support.grok-composer-2.5-fast: text input, 200k context, non-reasoning.
After login, the provider augments the curated list with additional chat models discovered from Grok Build. Image, speech-to-text, and voice-only model IDs are excluded from the chat picker.
Grok 4.6 uses Grok Build's Responses backend; existing models continue through Chat Completions.
Select a model explicitly with:
omp --model xai-grok-build/grok-4.6Limitations
- Manual callback input accepts the redirect URL or authorization code, not a refresh token. Keep the terminal private while entering the code.
- A stock host cannot enforce OAuth-only credentials at the same core boundary as a built-in provider. A runtime
--api-keyoverride is therefore not blocked by this extension. - Remote auth-broker callback-port forwarding is unavailable because
CALLBACK_PORTSis core-owned. Browser login uses local callback port8086. - The extension becomes inert when the host already provides
xai-grok-build, avoiding duplicate provider registration. - Marketplace installations do not load extension modules declared only through
package.json#omp.extensions. Install from npm or useomp plugin linkinstead.
Development
bun install
bun run typecheck
bun test ./testAll automated tests use mocked network responses. A live xAI authorization attempt is an optional publication smoke check because account authorization may be unavailable.
License
MIT
