feat(tools): Add GrokApi.ts — direct xAI client with model discovery and live X search#1005
Open
christauff wants to merge 1 commit intodanielmiessler:mainfrom
Open
feat(tools): Add GrokApi.ts — direct xAI client with model discovery and live X search#1005christauff wants to merge 1 commit intodanielmiessler:mainfrom
christauff wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
…and live X search GrokResearcher currently has no actual xAI API integration — it runs on Claude with a contrarian persona but cannot call Grok or access live X data. Adds: - PAI/Tools/GrokApi.ts: Zero-dependency xAI client with model discovery, self-healing model selection, x_search via Responses API, cost tracking - PAI/Tools/GrokApi.test.ts: 7 unit tests - Updated GrokResearcherContext.md: Correct models and API docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PAI/Tools/GrokApi.ts— direct xAI API client giving GrokResearcher actual Grok accessPAI/Tools/GrokApi.test.ts— 7 unit tests including self-heal verificationGrokResearcherContext.mdwith correct model names and API usageProblem
GrokResearcher has no actual xAI API integration. It runs on Claude with a contrarian persona but cannot call Grok or access live X/Twitter data. Model names in the context doc are stale.
Solution
GrokApi.tsis a zero-dependency xAI client (nativefetch) with:/v1/modelson startup, auto-selects best availableRequires
XAI_API_KEY. Fails gracefully without it.Test plan
bun test GrokApi.test.ts)🤖 Generated with Claude Code