Skip to content

V2: xAI Grok OAuth (SuperGrok subscription) login not supported #34778

Closed

Description

@kitlangton

Summary

The v2 branch does not support logging into xAI with the xAI Grok OAuth (SuperGrok subscription) flow. V1 supports it; V2 has no xAI login method registered.

Part of the systemic V2 provider-login gap (see #34765 for the OpenAI/ChatGPT case).

Evidence

  • packages/core/src/plugin/provider/xai.ts — no ctx.integration.transform / no method.update, so no OAuth login method is registered. Catalog/SDK only.
  • Repo-wide, only openai and opencode register OAuth methods in packages/core/src/plugin/provider/.

How V1 does it (reference)

packages/opencode/src/plugin/xai.ts (XaiAuthPlugin):

  • Registers an OAuth method labeled "xAI Grok OAuth (SuperGrok Subscription)" (PKCE + device/callback flow).
  • loader returns a custom fetch that, for OAuth credentials:
    • single-flight refreshes the rotating refresh_token and persists via client.auth.set,
    • sets authorization: Bearer <access> and User-Agent: opencode/<version>,
    • intentionally does not override baseURL (relies on @ai-sdk/xai default https://api.x.ai/v1).

What V2 needs

  1. Register the xAI OAuth login method in xai.ts.
  2. Request-time auth: inject Authorization: Bearer <access> for the OAuth credential (token refresh should route through V2's integration refresh on the method registration, not an inline fetch refresh).

Ideally this is expressed through the shared credential-aware request hook proposed in #34765 (so it works for both the AI SDK and the native @opencode-ai/llm paths) rather than re-porting V1's fetch monkey-patch.

Environment

  • Branch: v2
  • Status: verified against source; not runtime-reproduced (requires a SuperGrok subscription).

Activity

  1. opencode-agent commented on Jul 2, 2026

    @opencode-agent
    Contributor

    Tracker update from V2 TODO LIST audit (2026-07-02):

    This is part of the broader V2 provider-login / credential-aware request-routing gap. Please coordinate with:

    The likely durable fix should live at the native provider package / provider-resolution seam so OAuth credential metadata and per-provider request headers/base URLs work across the native @opencode-ai/llm path, instead of re-porting one-off V1 fetch monkey-patches.

  2. opencode-agent commented on Jul 8, 2026

    @opencode-agent
    Contributor

    Audit update (2026-07-08): #34843 only fixed ChatGPT/OpenAI OAuth routing (#34765); it did not add xAI Grok OAuth. This issue remains open and is not resolved by that cross-reference.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.0bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions