feat: add Grok SuperGrok / X Premium+ OAuth backend#18
Open
nelopuchades wants to merge 8 commits into
Open
Conversation
Add a grok cloud backend that authenticates via xAI subscription OAuth (browser PKCE or device-code), stores tokens in auth.json, refreshes automatically, and calls OpenAI-compatible chat completions at api.x.ai. Wire /login, /logout, /auth, /backend, /doctor, setup, and a Grok-specific stock system prompt so subscription traffic works without an API key.
Append the active model id and backend base URL to the per-turn status footer so it is always clear which endpoint handled the request.
Document /login grok, the grok backend, default model, and env overrides in the README and Unreleased changelog.
Grok now uses the same default system prompt as every other backend.
… work Keep SuperGrok OAuth backend changes and bring in remote 1.2.1 compaction-model work. Resolve CHANGELOG/README conflicts by retaining both feature sets.
Keep cargo fmt --check clean after the Grok OAuth and footer work.
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.
Motivation
Small Harness already supports cloud backends with API keys (OpenAI, OpenRouter, etc.), but SuperGrok / X Premium+ users often have subscription access without a separate API key workflow. Today that means either configuring a key manually or skipping Grok entirely.
This change adds first-class Grok OAuth so subscription users can log in once, keep credentials in the normal auth store, and use Grok like any other backend—without pasting secrets into config.
Summary of changes
UI
/login grok,/logout,/auth,/backend grok,/doctor, and first-run setup for the new backendBackend
grokcloud backend backed by xAI OAuth (browser PKCE or device-code)auth.json, then call OpenAI-compatible chat completions atapi.x.aiVerified by
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test(567 passed)Screenshots
Backend selector with new
grokoptionModel selector for new
grokbackendTurn footer with new backend and endpoint indicators