Skip to content

feat: add Grok SuperGrok / X Premium+ OAuth backend#18

Open
nelopuchades wants to merge 8 commits into
GetSmallAI:mainfrom
nelopuchades:feat/grok-oauth-backend
Open

feat: add Grok SuperGrok / X Premium+ OAuth backend#18
nelopuchades wants to merge 8 commits into
GetSmallAI:mainfrom
nelopuchades:feat/grok-oauth-backend

Conversation

@nelopuchades

@nelopuchades nelopuchades commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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

  • Wire /login grok, /logout, /auth, /backend grok, /doctor, and first-run setup for the new backend
  • Show active model and endpoint in the per-turn footer
  • Document the backend in README and Unreleased CHANGELOG

Backend

  • Add a grok cloud backend backed by xAI OAuth (browser PKCE or device-code)
  • Store and refresh tokens in auth.json, then call OpenAI-compatible chat completions at api.x.ai
  • Default to Grok 4.5, with documented env overrides
  • Keep the shared default stock system prompt (no Grok-specific prompt)

Verified by

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test (567 passed)

Screenshots

Backend selector with new grok option

backend_selector

Model selector for new grok backend

model_selector

Turn footer with new backend and endpoint indicators

footer

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.
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