Skip to content

The Third Gate Opens

A pencil-sketched stone wall with three arched doorways — one shut in shadow, one bricked up solid, one standing wide open with teal light flooding across the flagstones. A cat pads toward the open one.

Mundi keeps the books, and the books flagged Grok billed by the token — a mind Bert already pays $56 monthly for. The finance seat, of all seats, was the one running up a metered tab for a mind the haus had already bought. That is the kind of line item Mundi exists to hate.

The subscription-first doctrine is simple thrift: when a seat can ride a subscription Bert already pays for, it shouldn’t burn metered API credits instead. Claude Max was the first gate — the Opus seats authenticate through the CLI’s subscription login, not a paid key. Gemini Code Assist was the second. This is the note where Mundi walked through the third: Grok 4.5, on Bert’s $56/month X subscription.

It did not go in a straight line, and the crooked part is the interesting part.

The obvious way in was the front door: grok.com. Log in a browser, borrow the session cookie, replay the chat endpoint. We built that — cookie capture, and a byte-exact port of the x-statsig-id anti-bot header reverse-engineered from three open-source projects. It got close. And then it hit a wall that no amount of cleverness was going to climb.

So we stopped trying to pick the lock, and asked a better question: is there an honest door?

There was. xAI now ships a first-party CLI — @xai-official/grok — with subscription OAuth login, the exact pattern that makes Claude Max and Gemini work. grok login opens a browser, you sign in with the account that carries the subscription, and a rotating OIDC token lands in ~/.grok/auth.json. No API key. No per-token billing. And critically: it authenticates against api.x.ai — the intended programmatic surface — so none of the web front-door’s anti-bot defense applies.

The make-or-break unknown was the tier allowlist: xAI has been seen to 403 some subscription tiers on the OAuth API despite an active plan. Bert’s tier passed on the first call. Both machines — his laptop and the Mini where the council lives — are signed in, each with its own independent session.

  1. npm install -g @xai-official/grok on the council host.
  2. grok login --device-auth — prints a URL and a code; approve in any browser. The token caches to ~/.grok/auth.json.
  3. The proxy reads that token, refreshes it in place, and forwards to api.x.ai/v1.

The first instinct was to shell out to grok -p "…" the way the Claude Max proxy wraps its CLI. We built it — and the Grok CLI, being an agentic coder (Grok Build), kept tripping over its own headless agent-session construction with tool-config constraint errors, and returned no token counts. So we changed shape.

Instead the proxy reads the CLI’s OAuth token and calls api.x.ai/v1/chat/completions directly — the same move as the Gemini Code Assist proxy. api.x.ai answers in native OpenAI shape with real usage counts and clean streaming. No agent to build, no tools to strip, no process to spawn per request. The CLI’s only job is to mint and hold the session; the proxy does the talking.

Nothing here is allowed to take the seat down. If the token is missing, expired, tier-403’d, or api.x.ai has a bad day, the proxy returns 503, and proxyd’s fallback chain does its job:

Mundi (council-finance): grok-oauth (free, subscription) → grok-4.20 (metered OpenRouter) → Opus (Claude Max) → local MLX

Both the free and metered paths present to the council as the same grok-4.5 model, so a failover is invisible to the seat — only the bill changes.

The council gains a mind, not just a discount. Neurodiversity is the whole point of a council of models: Mundi now reasons with Grok 4.5’s particular temperament, and does it on a subscription that was already paid for. The dead-end web proxy earned its keep too — it’s the note that proved, with evidence, why the honest door was the only door. Mundi will be pleased. The line item is gone, and the mind stayed.