# Grok (xAI subscription)

> Sign in to a SuperGrok subscription with sc auth grok, declare the grok endpoint in config.toml, and run Claude Code's roles on Grok models.
>
> Run Claude Code's roles on xAI's Grok models through your SuperGrok subscription, with no API key. You need a SuperGrok subscription.

Grok is a SuperGrok subscription that `sc` reaches over xAI's OpenAI-compatible API, signed in with OAuth. Four steps declare it, sign you in and launch on it.

1. Add the grok endpoint and a profile

   Paste this into `~/.superclaude/config.toml`. The file `sc` writes on first run already carries the endpoint commented out, so you can uncomment it instead.

   ```toml
   [endpoints.grok]
   url = "https://api.x.ai"
   format = "openai-compat"
   auth = "oauth"

   [endpoints.grok.oauth]
   provider = "grok"

   [profiles.grok]
   opus = { slug = "grok/grok-4-fast" }
   ```

   The part after `grok/` is any model id your subscription serves; `grok-4-fast` is the shipped example. This profile maps only `opus`, so every role uses it.

2. Sign in

   ```sh
   sc auth grok
   ```

   Your browser opens and `sc` waits for you to finish the sign-in.

3. Check the routing

   ```sh
   sc profiles grok
   ```

   It prints a row for each of opus, sonnet and haiku with the model that role maps to; roles you did not set are marked as inherited.

4. Launch on it

   ```sh
   sc -u grok <project> <agent>
   ```

   The profile is a full gateway, so your Claude login is not used ([what changes](/docs/models#how-roles-map-to-models)).

`sc auth grok` stores the tokens in `config.toml` under `[endpoints.grok.oauth.identities.default]`, and the daemon refreshes them. `sc auth list` shows each identity and its expiry.

**I have no browser on this machine**

Run the device flow instead. It prints a URL and a one-time code to open on any device.

```sh
sc auth grok --device
```


**How is Grok different from Codex?**

Sign-in, labels, re-authentication and `sc auth list` work exactly as on [Codex](/docs/codex-setup). The differences:

| | Codex | Grok |
|---|---|---|
| Browser callback | `localhost:1455` | `127.0.0.1:56121` |
| Wire format | `openai-responses` | `openai-compat` |
| Account header | `ChatGPT-Account-Id` | none |
| Rate limit | per ChatGPT account | per subscription |
| `sc usage` | plan windows | one monthly window |


**Can I add a second Grok login?**

Yes, with a second label. It adds headroom only for a different subscription, because the rate limit is per subscription.

```sh
sc auth grok --label <name>
```


**Does reasoning effort work on a Grok row?**

No. The gateway has no reasoning field for Grok model ids, so a `reasoning` value on a Grok row sends nothing and the model uses its own default. `temperature` and `params` are sent as written.


**Use Grok and Codex in one profile**

The config `sc` writes on first run includes this profile, commented out. Sign in to both endpoints before you launch it.

```toml
[profiles.subscriptions]
opus   = { slug = "codex/gpt-5.5", reasoning = { effort = "high" } }
sonnet = { slug = "codex/gpt-5.4" }
haiku  = { slug = "grok/grok-4-fast" }
```

To keep Claude on the main loop instead, point `opus` at the `anthropic` passthrough endpoint ([Anthropic and Claude](/docs/provider-anthropic#keep-claude-on-some-roles)).
