> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcore.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Your Claude / Codex Subscription

> Point CORE at your Claude Max, ChatGPT Codex, Antigravity, or xAI Grok subscription — no API credits needed.

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 ships a subscription proxy that exposes an OpenAI-compatible API and translates to each provider under the hood.

<Warning>
  Subscription plans are licensed for **interactive** use. Providers can rate-limit or revoke tokens if they detect headless usage. Fine for personal self-host; risky if you're serving other users. When in doubt, use real API keys.
</Warning>

## Four steps

### 1. Deploy the gateway

The LLM proxy ships with the container image, so pick one of the container deployments:

* [Deployment → Docker](/gateway/deployment/docker) — your own server or VPS.
* [Deployment → Railway](/gateway/deployment/railway) — managed cloud.

Both paths end with a **Base URL** and a `gwk_...` **security key**. Keep both handy — you'll paste them into the UI in step 2 and reuse the same security key as the BYOK API key in step 4.

### 2. Add the gateway in the UI

In the CORE webapp: **Sidebar → Gateways → + New gateway**. Pick the deployment kind you used in step 1 (Docker or Railway), then paste the URL and security key.

### 3. Log in to your subscription

```bash theme={null}
corebrain gateway llmproxy --login claude
```

Pick the gateway you just added when prompted. Follow the printed OAuth URL — for Claude / Codex / Antigravity the browser redirect is caught automatically; for xAI you'll type a short device code shown in the terminal.

Repeat with `--login codex`, `--login antigravity`, or `--login xai` for other providers.

### 4. Wire it into CORE

In the webapp: **Settings → Models → + New API key**. Choose **OpenAI** and fill in:

* **Base URL** — `https://<your-gateway-host>/llmproxy/v1`
* **API key** — the same security key from step 1

Then pick a model with the `openai/` prefix. Examples:

| Model                      | Routes to       |
| -------------------------- | --------------- |
| `openai/claude-sonnet-4-6` | Claude Max      |
| `openai/claude-opus-4-7`   | Claude Max      |
| `openai/gpt-5.5`           | ChatGPT / Codex |
| `openai/gemini-2.0-flash`  | Antigravity     |
| `openai/grok-2-latest`     | xAI             |

Get the exact list of available models by hitting the proxy's model endpoint:

```bash theme={null}
curl -s https://<your-gateway-host>/llmproxy/v1/models \
  -H "Authorization: Bearer <your-COREBRAIN_GATEWAY_SECURITY_KEY>" | jq
```

## When a token expires

Just re-run the same login command:

```bash theme={null}
corebrain gateway llmproxy --login claude
```

The proxy 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 container restarts never blow them away.

## Under the hood

The gateway embeds [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI), which handles the OAuth flow for each subscription and re-shapes the requests into each provider's native protocol behind a single OpenAI-compatible surface at `/llmproxy/v1`. That's why one Base URL + one API key covers Claude, Codex, Antigravity, and xAI.

Other proxies exposing the same OpenAI-compatible shape work with the same wire-up if you'd rather run them yourself:

* **[Vercel AI Gateway](https://vercel.com/docs/ai-gateway/coding-agents/claude-code)** — first-party pass-through for Claude Max via `ANTHROPIC_BASE_URL`. No self-hosting.
* **[ai-cli-proxy-api](https://github.com/ben-vargas/ai-cli-proxy-api)** — variant that supports Factory and Amp CLIs alongside ChatGPT Plus/Pro and Claude Pro/Max.
