Skip to content

feat(ai): SuperGrok OAuth device login - #752

Open
valtterivalo wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
valtterivalo:feat/xai-supergrok-oauth
Open

feat(ai): SuperGrok OAuth device login#752
valtterivalo wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
valtterivalo:feat/xai-supergrok-oauth

Conversation

@valtterivalo

@valtterivalo valtterivalo commented Aug 6, 2026

Copy link
Copy Markdown

Adds SuperGrok / X Premium device OAuth on the existing xai provider. Tokens refresh automatically. Default xAI model is grok-4.5.

/login → xAI SuperGrok, then use built-in xAI models against api.x.ai.


Note

Medium Risk
Introduces OAuth token acquisition and refresh against xAI’s auth endpoints and changes the default xAI model, which affects auth handling and out-of-the-box model selection without touching core inference paths.

Overview
Adds SuperGrok / X Premium subscription auth for the existing xai provider via OAuth device login (open verification URL, enter user code, poll until authorized). loginXai, refreshXaiToken, and xaiOAuthProvider are exported from prime-agent-ai/oauth and registered alongside the other built-in OAuth providers so /login and getOAuthApiKey can use the same xai auth slot as API keys.

The device flow polls auth.x.ai with authorization_pending / slow_down handling, rejects non-HTTPS verification URLs, and refreshes access tokens while preserving the refresh token when the issuer does not rotate it. Vitest coverage exercises polling, URL hardening, refresh, and registry wiring.

Docs and changelogs in packages/ai and packages/coding-agent document the new login path. The coding-agent default xAI model changes from grok-4.20-0309-reasoning to grok-4.5.

Reviewed by Cursor Bugbot for commit c2c3b54. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add xAI SuperGrok OAuth device login flow to the xAI provider

  • Implements OAuth 2.0 device authorization flow in packages/ai/src/utils/oauth/xai.ts, supporting polling with authorization_pending, slow_down backoff, access_denied, and expired_token error handling.
  • Adds loginXai and refreshXaiToken functions and registers xaiOAuthProvider in the built-in OAuth provider registry so getOAuthProvider('xai') resolves to it.
  • Changes the default xAI model in packages/coding-agent/src/core/model-resolver.ts from grok-4.20-0309-reasoning to grok-4.5.
  • Behavioral Change: non-HTTPS verification URIs returned in device responses are now rejected with an error.

Macroscope summarized c2c3b54.

zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
- Add OpenAI Codex official support entry
- Add pi-internal:// URL scheme
- Add ctx.shutdown() fix (PrimeIntellect-ai#756)
- Add OpenAI Codex retry logic (PrimeIntellect-ai#733)
- Add third-party contributions:
  - PrimeIntellect-ai#702 by @aliou (custom tool HTML export)
  - PrimeIntellect-ai#728 by @richardgill (frontmatter parsing, SelectList fix)
  - PrimeIntellect-ai#747 by @kaofelix (tree filter shortcuts)
  - PrimeIntellect-ai#752 by @richardgill (keymap expansion)
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.

1 participant