Skip to main content
If you already pay for Claude Max, a ChatGPT plan that includes Codex, Google Antigravity, or xAI Grok, you can point CORE at your subscription instead of buying separate API credits. The CoreBrain Gateway includes a subscription proxy (CLIProxyAPI) that speaks OpenAI-compatible on the outside and translates to each subscription’s native protocol on the inside.
Subscription plans are licensed for interactive use. Providers can rate-limit or revoke tokens if they detect headless usage. Fine for personal self-host on a laptop or single VPS; risky if you’re serving other users. When in doubt, use real API keys.

The whole setup, four steps

1. Deploy the gateway

Pick one of Railway, Docker, or native. The gateway image bundles CLIProxyAPI, so nothing extra to install. On first boot it prints a public URL and a gwk_... security key.

2. Register the gateway in CORE

In the CORE webapp: Sidebar → Gateways → + New gateway. Paste the URL and security key.

3. Install the CLI and log in to your workspace

4. Log in to each subscription

One command per subscription. The CLI drives the OAuth flow end-to-end and lands tokens directly on the gateway.
Two flow types depending on the provider:
  • Claude / Codex / Antigravity — CLI prints an OAuth URL. Open it, approve, and the CLI’s local server catches the redirect and forwards it to the gateway. Nothing to type back.
  • xAI — CLI prints a URL and a short code. Open the URL, type the code on the page, done.
Add --gateway <name-or-id> if you have multiple gateways registered.

Wire the proxy into CORE

In the CORE webapp, open Workspace Settings → Models → API Keys, click + Add API key, choose OpenAI, and fill in:
  • Base URLhttps://<your-gateway-host>/llmproxy/v1
  • API key — the same COREBRAIN_GATEWAY_SECURITY_KEY value from step 1
Then pick a model with the openai/ prefix. Examples: Get the exact list of available models by hitting the proxy’s model endpoint:

When a token expires

Just re-run the same command:
CLIProxyAPI auto-rotates access tokens as long as the refresh token stays valid; when it doesn’t, re-login. Tokens live on the gateway’s persistent volume, so a container restart never blows them away.

Structured outputs & tool calling

Under the hood, CORE routes structured-extraction calls (memory ingestion, label classification, etc.) via OpenAI-compatible tool calling. Claude’s grammar-constrained sampling makes this reliable even for empty content — the model will call the tool with empty arrays rather than respond with prose refusals like “there’s nothing to extract.”

Alternatives

The steps above use the built-in CLIProxyAPI inside the gateway. Other options exposing an OpenAI-compatible /v1/chat/completions surface work with the same BYOK wire-up:
  • Vercel AI Gateway — first-party pass-through for Claude Max via ANTHROPIC_BASE_URL. No self-hosting.
  • ai-cli-proxy-api — variant that supports Factory and Amp CLIs alongside ChatGPT Plus/Pro and Claude Pro/Max.