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

# Subscriptions

> Serve requests from your ChatGPT, Claude Code, GitHub Copilot, Grok, Muse Code, OpenCode Go, and Vercel Token Pass plans, pooled across accounts.

The gateway can serve requests from a personal ChatGPT, Claude Code, GitHub Copilot, Grok, Muse Code, OpenCode Go, or Vercel Token Pass plan instead of an API key. Connect each plan once. Routers with `subscriptions: true` use them.

## Connect A Plan

Run `dari accounts` and choose **Add a subscription**. It can also buy a new plan: it opens the provider's plan page, then connects the new account.

Scripts connect each plan with one command. Point the [Dari CLI](https://docs.dari.dev/install-cli.md) at your gateway first:

```bash theme={null}
export DARI_GATEWAY_URL=http://127.0.0.1:8080
export DARI_GATEWAY_KEY=<one of DARI_GATEWAY_KEYS>

dari accounts subscription connect claude-code
dari accounts subscription connect codex
dari accounts subscription connect github-copilot
dari accounts subscription connect grok
dari accounts subscription connect muse-code
dari accounts subscription connect opencode-go
dari accounts subscription connect vercel-token-pass
```

Each provider signs in differently:

* **Claude Code.** Sign in with Anthropic in your browser, then paste the code it shows into the terminal.
* **ChatGPT (`codex`).** Enter the device code shown in the terminal on OpenAI's page. The gateway waits for you to approve it.
* **GitHub Copilot.** Enter the device code shown in the terminal on GitHub's page, with the account that holds your Copilot plan. GitHub Enterprise accounts aren't supported yet.
* **Grok.** Enter the device code shown in the terminal on xAI's page, with the account that holds your SuperGrok plan.
* **Muse Code.** Enter the device code shown in the terminal on Meta's page. The gateway then mints a Model API key for the subscription.
* **OpenCode Go.** Enter the device code shown in the terminal in the OpenCode console, and choose the workspace that holds your Go subscription. This is the sign-in `opencode auth login` runs.
* **Vercel Token Pass.** Create a Token Pass key with `vercel token-pass`, or create an AI Gateway API key and choose **Restrict to Token Pass only**, then paste it into the terminal. A Token Pass key serves only Vercel's featured models and never bills overage.

Without a terminal, as when an agent runs the command, the device-code sign-ins wait for your approval by themselves for up to 10 minutes.

## Manage Plans

`dari accounts` lists each plan with its usage and reset times. ChatGPT plans also show their plan and renewal date. Choose a plan there to manage it at the provider, rename, reconnect, mark it available, or disconnect it.

The same operations work from scripts:

| Command | Does |
| - | - |
| `dari accounts subscription list` | Shows the order, the active plan, and holds. |
| `dari accounts subscription rename claude-code work` | Gives a connection your own name. |
| `dari accounts subscription mark-available codex` | Clears a usage-limit hold early. |
| `dari accounts subscription disconnect codex` | Removes a connection. |

Reconnect a plan that has expired with `--reconnect <name>`. Commands that take a plan accept `claude-code` or `codex`, or the name of a connection from `list`.

## Usage Limits

When a plan hits its usage limit, the gateway holds it until the provider's reset time. The refused request goes to the next connection at once, so the client gets an answer instead of the error.

* **Per-model limits.** A limit on one model holds only that model. The connection keeps serving the router's other models. The refused request returns a retryable `503`, and the retry routes elsewhere. `dari accounts subscription list` shows these as `model_holds`.
* **No connection left.** If every connection of a plan is held, the request moves to the next plan that serves the model, then to the provider's API key, if one is set. Otherwise the request returns `424 personal_subscription_unavailable`.
* **Ending a hold.** A held connection or model returns when its reset passes, or when you run `mark-available`. `list` shows each connection's reported `usage`.

## One Model, Several Plans

Several plans can serve the same model. GitHub Copilot, for example, also serves Claude and GPT models. A request tries the model maker's plan first, then the other connected plans that serve it, in this order: Claude Code, ChatGPT, Grok, Muse Code, OpenCode Go, GitHub Copilot, Vercel Token Pass. The provider's API key comes last. The gateway moves on within the same request, before the client sees any output, when a plan is held, hits its limit, or the provider rejects its sign-in.

## Pooling

Connect more than one account per provider to pool them. The gateway picks a connection for each conversation:

* **A conversation stays on its connection**, so its prompt cache stays warm.
* **New conversations** start on the connection whose quota resets soonest, so quota about to reset is used first. Ties go to the connection used last, then to connection order.
* **Claude Code connections** report usage on every response. Once a connection has used 95% of a window, its conversations move to another connection at their next turn, before the provider starts refusing requests.

## Who Can Use Which Plan

Each plan serves only the clients its terms allow:

| Plan | Serves | For clients |
| - | - | - |
| Claude Code | Anthropic models | Claude Code only |
| ChatGPT (`codex`) | OpenAI models | Every client |
| GitHub Copilot | `github-copilot/<model>` models | Every client |
| Grok | xAI models | Every client |
| Muse Code | Meta models | Muse Code only |
| OpenCode Go | `opencode-go/<model>` models | Every client |
| Vercel Token Pass | Vercel's featured models, as `vercel-token-pass/<model>` | Every client |

The gateway recognizes Muse Code by the `x-client-id` header it sends. Requests from other clients fall through to the provider's API key, or are refused if none is set.

## Turn Subscriptions Off

A router with `subscriptions: false` never uses a connected plan. Its requests use API keys only. See [Configure Routers](https://docs.dari.dev/gateway/configure-routers.md#routers).

## Storage

Connected plans are stored in the gateway database at `DARI_GATEWAY_DB`, with each plan's access tokens in plaintext. Protect the database like a secret. See [Operations](https://docs.dari.dev/gateway/operations.md#storage).

## Details

> [accordion] Usage reporting by provider
>
> Muse Code plans report their five-hour and weekly windows at the end of every response. OpenCode Go plans don't report usage on responses, so `dari accounts` reads their five-hour, weekly, and monthly windows from OpenCode, at most once a minute.

> [accordion] Connection names and pooling edge cases
>
> The CLI names each connection in the order it was connected. When every connection is past 95%, the least used one serves. ChatGPT plans report usage only in their response stream, which the gateway does not read yet, so they switch only on a usage limit.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.