Skip to content

feat: add xAI web search provider - #25

Merged
emilsvennesson merged 2 commits into
emilsvennesson:mainfrom
mcostasilva:feat/xai-websearch
Aug 23, 2026
Merged

emilsvennesson merged 2 commits into
emilsvennesson:mainfrom
mcostasilva:feat/xai-websearch

Conversation

@mcostasilva

@mcostasilva mcostasilva commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add native xAI/Grok web search through the Responses API.
  • Support API keys and SuperGrok OAuth with token refresh.
  • Add citation handling, provider tests, and documentation updates.

Why pass a custom fetch function?

OpenCode’s SuperGrok OAuth provider exposes a dummy API key because authentication happens inside a custom fetch wrapper. Since the xAI adapter creates its own Responses API client, the OAuth resolver passes that wrapper through the shared client configuration. This allows token refresh and bearer-token injection without changing API-key authentication.

Why extract credential attachment helpers?

Adding xAI OAuth handling to loadResolutions would exceed the 20-statement limit. The existing ChatGPT and Copilot credential logic was moved unchanged into focused helpers; provider selection behavior remains the same.

Validation

  • bun run check
  • bun run build
  • Live-tested with Grok 4.6

@mcostasilva
mcostasilva marked this pull request as ready for review August 14, 2026 09:37
@emilsvennesson
emilsvennesson merged commit 775eac4 into emilsvennesson:main Aug 23, 2026
1 check passed
@emilsvennesson

Copy link
Copy Markdown
Owner

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants