pi-xai
Pi extension for xAI text generation via Responses API — reasoning, multi-agent, structured outputs, tools
Package details
Install pi-xai from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-xai- Package
pi-xai- Version
0.9.0- Published
- Jun 19, 2026
- Downloads
- 684/mo · 103/wk
- Author
- luxusai
- License
- MIT
- Types
- extension
- Size
- 96.7 KB
- Dependencies
- 1 dependency · 0 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-xai
Pi extension for xAI Grok Build — Responses API, native OAuth, three tools, agentic built-ins.
Reference: Hermes Agent (xAI OAuth, native web_search / x_search) and xAI Responses docs.
Grok Build models need a SuperGrok or X (x.com) subscription — /login grok-build. XAI_API_KEY still works for API-key access.
Quick start
pi install npm:pi-xai
/login grok-build
/model grok-build/grok-build-0.1
Live X news: agentic x_search or xai_x_search — not harness x_semantic_search / x_keyword_search.
Tools
| Tool | Purpose |
|---|---|
xai_generate_text |
Full Responses API (tools, previousResponseId, JSON schema, reasoningEffort, store) |
xai_multi_agent |
grok-4.20-multi-agent research |
xai_x_search |
Native x_search (grok-4.20-reasoning, optional dates, store: false) |
Web search / code execution: xai_generate_text with tools: ["web_search"] or ["code_interpreter"], or agentic mode.
Agentic mode
Default on. ~/.pi/agent/settings.json:
{
"xai": {
"text": {
"agentic": true,
"agenticTools": ["web_search", "x_search", "code_interpreter"]
}
}
}
Provider payload
For all grok-* chat, before_provider_request sanitizes OpenAI-only fields, merges native built-ins with Pi tools (mergeXaiTools), fixes empty content (normalizeForXai), moves system/developer to instructions, and stringifies array function_call_output. Direct /responses from siblings: import { normalizeForXai } from "pi-xai".
xAI Responses (Pi defaults)
| Pi chat | xai_x_search |
|
|---|---|---|
store |
default true (30d) | false |
include: reasoning.encrypted_content |
reasoning models | omitted |
| Chain turns | previous_response_id / Pi history |
one-shot |
Development
npm install && npm run check && npm test
npm run verify:deps # patched undici/ws/protobufjs until pi publishes dep fix (earendil-works/pi main)
index.ts, xai-config.ts, xai-oauth.ts, xai-provider.ts. Transitive audit noise: waiting on upstream fix: update vulnerable dependencies after 0.79.7. See CHANGELOG.md.