Skip to content

feat(proxy): add xai upstream adapter for Grok via OAuth#28356

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704
May 19, 2026
Merged

feat(proxy): add xai upstream adapter for Grok via OAuth#28356
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #28064 (@yannsunn).

Summary

Adds an xai upstream adapter to hermes proxy, backed by the existing xai-oauth credential pool. External OpenAI-compatible clients can now route through Hermes's xAI OAuth credential without re-implementing PKCE refresh or token recovery.

Changes

  • hermes_cli/proxy/adapters/xai.py (new): forwards /v1/responses, /v1/chat/completions, /v1/completions, /v1/embeddings, /v1/models. Uses load_pool('xai-oauth') so manual:xai_pkce entries from hermes auth add xai-oauth --type oauth and singleton-seeded loopback_pkce entries share the existing OAuth refresh behavior. 401 triggers one pool refresh/rotation attempt via the adapter retry hook.
  • hermes_cli/proxy/adapters/__init__.py: registers xai alongside nous_portal.
  • hermes_cli/proxy/cli.py + hermes_cli/main.py: hermes proxy providers now lists xai; auth hints updated.
  • tests/hermes_cli/test_proxy.py: registry/metadata, pool-backed credential resolution, default base URL, 401 refresh retry behavior.

Validation

  • scripts/run_tests.sh tests/hermes_cli/test_proxy.py -q → 36/36 passing.

Authorship preserved via cherry-pick. AUTHOR_MAP entry added in a follow-up commit.

@teknium1 teknium1 merged commit 2064a39 into main May 19, 2026
16 of 17 checks passed
@teknium1 teknium1 deleted the hermes/hermes-6063e704 branch May 19, 2026 03:09
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-6063e704 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8791 on HEAD, 8791 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4626 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard provider/xai xAI (Grok) labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/xai xAI (Grok) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants