whatisgithub

What is grok-oauth-proxy?

yelixir-dev/grok-oauth-proxy — explained in plain English

Analysis updated 2026-05-18

11PythonAudience · developerComplexity · 3/5Setup · moderate

In one sentence

A local proxy server that lets tools built for the OpenAI API talk to xAI's Grok models by reusing OAuth tokens from another app called Hermes.

Mindmap

mindmap
  root((grok-oauth-proxy))
    What it does
      OpenAI compatible proxy
      Reuses Hermes OAuth
      Talks to Grok models
    Tech stack
      Python FastAPI
      Prometheus metrics
    Safety
      Fail closed startup
      Token prewarming
      Auth file watcher
    Use cases
      Local chat clients
      Headless server setup
      Avoid separate API key

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Point any OpenAI-compatible tool at Grok models without paying for a separate xAI API key.

USE CASE 2

Run a local proxy that automatically refreshes OAuth tokens so a chat client stays connected to Grok.

USE CASE 3

Monitor the proxy's health and metrics with Prometheus in a self hosted setup.

USE CASE 4

Set up Grok access on a headless Linux server by importing tokens from a desktop machine.

What is it built with?

PythonFastAPIOpenAI APIPrometheus

How does it compare?

yelixir-dev/grok-oauth-proxy2arons/llm-cliadzza/guardium-dns
Stars111111
LanguagePythonPythonPython
Setup difficultymoderateeasymoderate
Complexity3/52/53/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Hermes Agent already logged in via OAuth on the same machine.

So what is it?

Grok OAuth Proxy is a small local server that lets you talk to xAI's Grok models from any tool that already understands the OpenAI API, without having to obtain or pay for an xAI API key directly. It does this by piggybacking on the browser-based OAuth login that another tool, Hermes Agent, has already completed on your machine. The proxy reads the OAuth tokens that Hermes saved in ~/.hermes/auth.json, copies them into its own permission-locked file, and uses them to call api.x.ai on your behalf. It is written in Python with the FastAPI framework. To a client like LiteLLM, the OpenAI Python SDK, or a plain curl command, it looks like a normal OpenAI server at http://127.0.0.1:9996, exposing the usual /v1 routes including streaming chat completions. Behind the scenes it strips client credentials, injects a short-lived Bearer token, and forwards the request to xAI. The project takes a fail-closed approach to safety. At startup it verifies that Hermes is installed, that the xai-oauth provider is present, and that an OAuth client id is available, if any of that is missing, it refuses to start rather than falling back to anonymous credentials. Token refreshes are handled in a background loop with prewarming before expiry, plus a watcher on the Hermes auth file so that re-logins are picked up automatically. There is a /health endpoint with an optional deep mode that pings upstream, a /metrics endpoint for Prometheus, and automatic retries on transient upstream failures for idempotent requests. Installation is documented for two scenarios: a desktop Mac where Hermes already did the browser login, and a headless Linux server that imports an exported OAuth bundle from a desktop machine. systemd and launchd recipes are provided for keeping it running. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Help me install and run this Grok OAuth proxy on my Mac using Hermes Agent's login.
Prompt 2
Show me how to point the OpenAI Python SDK at this proxy's local server.
Prompt 3
Explain how the token refresh and prewarming logic works in this project.
Prompt 4
Walk me through setting up the headless Linux install using an exported OAuth bundle.

Frequently asked questions

What is grok-oauth-proxy?

A local proxy server that lets tools built for the OpenAI API talk to xAI's Grok models by reusing OAuth tokens from another app called Hermes.

What language is grok-oauth-proxy written in?

Mainly Python. The stack also includes Python, FastAPI, OpenAI API.

How hard is grok-oauth-proxy to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is grok-oauth-proxy for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.