feat: add xai-proxy — OAuth PKCE sidecar for xAI SuperGrok#841
Merged
Conversation
Lightweight Rust binary that authenticates with xAI via browser OAuth (PKCE, borrowing Grok CLI's public client ID) and proxies OpenAI-compatible requests to api.x.ai/v1 with the subscription token injected. Allows any OpenAI-compatible coding agent (Claude Code, OpenCode, Codex CLI, etc.) to use SuperGrok subscription quota instead of per-token API credits.
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
Adds `login-device` subcommand that uses RFC 8628 device authorization grant. Works in K8s exec, ECS exec, SSH — no browser or port-forward needed. Usage: xai-proxy login-device # prints verification URL + user code # poll until user approves on any device
…PATH env var - Add rustls as direct dep and call install_default() in main() to fix 'Could not automatically determine CryptoProvider' panic on serve - Support XAI_PROXY_TOKEN_PATH env var for custom token file location (useful for K8s PVC persistence at e.g. /home/agent/.openab/xai-proxy/tokens.json) - Add Dockerfile for container builds
thepagent
approved these changes
May 18, 2026
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.
Summary
Adds
xai-proxy, a lightweight Rust single-binary sidecar that:api.x.ai/v1with the OAuth token injectedThis allows any OpenAI-compatible coding agent (OpenCode, Hermes, etc.) to use SuperGrok subscription quota instead of per-token API credits.
Architecture
Usage
What was tested
cargo build --releasepasses on Rust 1.86+Notes
openid profile email offline_access grok-cli:access api:access~/.xai-proxy/tokens.json(chmod 600) or custom path viaXAI_PROXY_TOKEN_PATHrustlscrypto provider (ring) — installed automatically at startupThread: 1505301662309552260