feat(providers): xAI Coding Plan OAuth provider#26445
Closed
avirweb wants to merge 2 commits into
Closed
Conversation
- xai-coding-plan profile with Grok CLI OAuth delegation - Curated model list: grok-build, grok-4-1-fast, grok-code-fast-1, grok-4.3, grok-4.3-latest - providers.py ALIASES + HERMES_OVERLAYS for resolution chain - Legacy xai-oauth alias registration for backward compatibility - models.dev mapping and test plugin count bump
- Import Grok CLI OAuth tokens from ~/.grok/auth.json - resolve_xai_coding_plan_credentials with expiry/refresh handling - _login_xai_coding_plan flow with grok login --device-auth - ProviderConfig entry for xai-coding-plan in PROVIDER_REGISTRY - Config persistence with force_default_model for atomic provider/base_url/model - credential_pool seeding for same-provider fallback - Tests for token expiry, credential resolution, and config persistence
Collaborator
19 tasks
Author
|
The one authored by Mind Dragon is mine - but this 26445 is cleaner and more atomic. I will close 25941
25968 is missing things like model list and so on. This or credits and supersedes it.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Siddharth Balyan ***@***.***>
Sent: Friday, May 15, 2026 11:25:50 AM
To: NousResearch/hermes-agent ***@***.***>
Cc: Jefferson Nunn ***@***.***>; Author ***@***.***>
Subject: Re: [NousResearch/hermes-agent] feat(providers): xAI Coding Plan OAuth provider (PR #26445)
[https://avatars.githubusercontent.com/u/52913345?s=20&v=4]alt-glitch left a comment (NousResearch/hermes-agent#26445)<#26445 (comment)>
Duplicate of #25941<#25941> — same xAI Coding Plan OAuth provider feature. Also competes with #25968<#25968>. Please consolidate into one of those existing PRs.
—
Reply to this email directly, view it on GitHub<#26445 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/B5L4X2UJDV7CL4RDHRZE7OD425AI5AVCNFSM6AAAAACY7VNHIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINRRGQ3TMOBSGM>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
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.
Problem
The existing
xaiprovider only supports direct API-key auth (XAI_API_KEY). Users who have an xAI Coding Plan subscription (which uses OAuth via the official Grok CLI) have no way to use their credentials in Hermes —hermes setupand/modeloffer no OAuth path, and the model picker dumps the full xAI catalog instead of the 5 Coding Plan-eligible models.Solution
Adds a distinct
xai-coding-planprovider that delegates login to the installed Grok CLI, imports its OAuth token from~/.grok/auth.json, and presents only the curated Coding Plan model list.What this PR adds
Provider profile (commit 1):
xai-coding-planin_PROVIDER_MODELSwith curated list:grok-build,grok-4-1-fast,grok-code-fast-1,grok-4.3,grok-4.3-latestproviders.pyALIASES +HERMES_OVERLAYS,auth.pyPROVIDER_REGISTRY, plugin discovery, models.dev mappingxai-oauthplugin alias for backward compatibility with any prior configsAuth flow (commit 2):
_login_xai_coding_plan()— delegates togrok login --device-auth_import_grok_cli_into_hermes()— reads~/.grok/auth.json, imports OAuth token, handles expiry/refreshresolve_xai_oauth_runtime_credentials()— runtime credential resolution with relogin-required errors on expired tokensModel picker fix:
_model_flow_xai_oauthuses the curated list directly instead of live API fetch (xAI API returns all models, burying the 5 Coding Plan models)Why this needs merging
None of this exists on
main. The codebase currently has:/model"Unknown provider" bug for xai-coding-plan aliases (caused by missingproviders.pyALIASES entry)Credits
Original xAI Coding Plan attempt by @ams432 — that PR had broken elements (incomplete resolution chain, stale alias mappings, live API fetch instead of curated list) which were fixed in this rebuild. The concept of Grok CLI OAuth delegation and terminal/web auth flows originates from ams432's work.
This replaces the earlier attempt at #25941 (Mind-Dragon fork, closed) and is a clean, atomic rebuild with the full resolution chain fix.
Test plan
Files changed