Feature request: xAI Grok (SuperGrok) subscription OAuth login — implementation ready (was PR #1681) #1682
mddinizbh
started this conversation in
Feature requests
Replies: 1 comment
|
I need this too, thanks for the implementation |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
/loginsupports subscription-based OAuth for Anthropic (Claude Pro/Max), GitHub Copilot, and OpenAI (ChatGPT Plus/Pro), butxaionly accepts an API key. SuperGrok subscribers have no way to use their subscription with Prime Agent — today we work around it by copying the OAuth access token out of opencode'sauth.jsoninto anapi_keycredential and hand-rolling a refresh script.Proposed feature
A built-in
xaiOAuth provider ("xAI Grok (SuperGrok Subscription)") so/logintreats Grok subscriptions like the other subscription providers: browser sign-in, automatic refresh before expiry,/logout, auth status — all through the existingOAuthProviderInterfaceregistry.Implementation details (validated against the real endpoints):
auth.x.aiusing the shared Grok CLI OAuth client and its registered loopback redirect (127.0.0.1:56121/callback) — the same client opencode uses, so it works today without registering a new OAuth app.onAuthdialog.refreshXaiTokenreturns the new one soAuthStoragepersists it, matching the other providers.Registration is one entry in
BUILT_IN_OAUTH_PROVIDERS; thexaimodel provider (base URLapi.x.ai/v1,openai-completions) already accepts the OAuth access token as a Bearer token, so no other packages change.Work already done
PR #1681 (closed by the vouched-contributor policy, understood). The branch
feat/xai-grok-oauth-loginon my fork carries the full change:packages/ai/src/utils/oauth/xai.tsfollowing the conventions ofopenai-codex.ts/anthropic.tspackages/ai/test/xai-oauth.test.ts) — passingpackages/ai/.changes/feat-xai-grok-oauth-login.md)biome check --error-on-warningsandtsgo --noEmit(pre-commit hooks passed)xai/grok-code-fast-1succeeded using only the OAuth access tokenFull disclosure: this work was agent-authored (Prime Agent + IPython tooling), driven and verified end-to-end by me. Per CONTRIBUTING.md I take responsibility for how it interacts with the project and am happy to walk through any part of it, adjust the design, or rework the implementation to maintainer feedback.
Ask
I'd also like to grow into a trusted contributor over time — happy to start with issue investigation, testing, or docs wherever it's useful.
All reactions