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

# Your own Claude plan

> Run Claude Code on your personal Claude plan through the AI Gateway, so your organization's model rules apply while your plan covers the cost, and what happens when the plan's limit is reached.

When your organization allows **Bring your own subscription** ([License model](https://docs.xpander.ai/run/llm-gateway/policies.md#license-models)), Claude Code can run on your own Claude plan (Pro or Max) through the AI Gateway. Your calls cost your organization nothing and count toward no budget, while your organization's model rules still apply and your calls still show in your usage.

## Set up Claude Code on your plan

![Connect a client with Claude Code selected and the Use my Claude Pro or Max plan first checkbox](https://mintcdn.com/xpanderai-099931d1/65C_XNxucwf3Ltb_/images/llm-gateway/02-own-plan-checkbox.png?fit=max\&auto=format\&n=65C_XNxucwf3Ltb_\&q=85\&s=3986fe703b73e8a8ed465d5fc636a8a9)

The Claude Code option in AI models and keys, with Use my Claude Pro or Max plan first.

> [!NOTE]
>
> Available when your organization turns it on: an admin allows **Bring your own subscription** in the [License model](https://docs.xpander.ai/run/llm-gateway/policies.md#license-models). Until then the gateway answers that your own Claude plan is not enabled.

Claude Code keeps your Claude plan sign-in and sends your calls through the AI Gateway. You need an xpander API key from [AI models & keys](https://chat.xpander.ai/?settings=my-gateway) (**Create key**).

**The quick way:** in [AI models & keys](https://chat.xpander.ai/?settings=my-gateway), under **Connect a client**, pick **Claude Code** and tick **Use my Claude Pro or Max plan first**. Choose **Copy setup command**, paste it in your terminal and press Enter; it creates a key for you. Then run `/login` in Claude Code and choose your Claude account.

To set it up by hand instead, follow these steps. Unlike a setup with only an xpander key, this option needs Claude Code signed in with your Claude plan first.

1. **Sign in with your plan.** Run `claude`, type `/login`, and choose your Claude account (Pro or Max).
2. **Point Claude Code at the gateway, for every session.** Add this to Claude Code's settings file, `~/.claude/settings.json` on macOS and Linux (inside WSL when you use it), `%USERPROFILE%\.claude\settings.json` on Windows. Replace `<your key>` with your xpander API key:

   ```json theme={"dark"}
   {
     "env": {
       "ANTHROPIC_BASE_URL": "https://llm-gw.xpander.ai",
       "ANTHROPIC_CUSTOM_HEADERS": "x-xpander-api-key: <your key>"
     }
   }
   ```

   Do not add `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY`, and make sure your terminal does not set them: either one replaces your plan sign-in. The address is the same when your organization runs a Hybrid install. Your own plan is not available on an Air-Gapped install.

   To try it in one terminal only, set the same values there instead. The commands differ by system:

   ```bash macOS / Linux / WSL theme={"dark"}
   unset ANTHROPIC_AUTH_TOKEN ANTHROPIC_API_KEY
   export ANTHROPIC_BASE_URL='https://llm-gw.xpander.ai'
   export ANTHROPIC_CUSTOM_HEADERS='x-xpander-api-key: <your key>'
   claude
   ```

   ```powershell Windows PowerShell theme={"dark"}
   Remove-Item Env:ANTHROPIC_AUTH_TOKEN, Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
   $env:ANTHROPIC_BASE_URL="https://llm-gw.xpander.ai"
   $env:ANTHROPIC_CUSTOM_HEADERS="x-xpander-api-key: <your key>"
   claude
   ```

   ```bat Windows cmd theme={"dark"}
   set ANTHROPIC_AUTH_TOKEN=
   set ANTHROPIC_API_KEY=
   set "ANTHROPIC_BASE_URL=https://llm-gw.xpander.ai"
   set "ANTHROPIC_CUSTOM_HEADERS=x-xpander-api-key: <your key>"
   claude
   ```

   With WSL, run the commands inside WSL, not in Windows. The bash form `NAME=value claude` does nothing in PowerShell or cmd, and Claude Code then goes straight to Anthropic.
3. **Use Claude model names.** Calls on your plan go to Anthropic only. Keep Claude Code's own model names, such as `claude-sonnet-4-6`, rather than a model ID from another provider.
4. **Check that it works.** Run `claude -p "reply with exactly: OK"`. In Claude Code, `/status` must show your Claude account and `https://llm-gw.xpander.ai` as the base URL. If it shows an auth token or API key instead, `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY` is set somewhere and replaces your plan. An admin can also confirm it in [Logs](https://platform.xpander.ai/governance/logs): your newest request shows the client Claude Code and the license model **Bring your own subscription**, with the cost covered by your plan and no credits used.

### If something goes wrong

| Claude Code shows | What to do |
| - | - |
| This credential is not an active xpander key | The `x-xpander-api-key` header is missing or the key is wrong, revoked or expired. Check `ANTHROPIC_CUSTOM_HEADERS`, or create a new key. |
| `/status` does not show the gateway address | Claude Code goes straight to Anthropic because `ANTHROPIC_BASE_URL` is not set where Claude Code runs. Check `/status`, and use the commands for your system above. |
| Your own Claude plan is not enabled for this call | Your organization has not allowed your own subscription for you, or the model is not a Claude model from Anthropic. Ask your admin, or use a Claude model name. |
| Your Claude plan's usage limit is reached until ..., and plan calls are set to wait for the plan | Your calls pause at the limit, by your choice or your organization's. The call can run again after the time shown. |
| Your Claude login expired | Run `/login` in Claude Code again, then retry. |
| Anthropic did not allow this call on your Claude plan | The model or feature is not part of your plan. Pick another model. |
| A spending limit message | Calls on your plan never count toward budgets. This call ran on your organization's key, for example after your plan reached its limit, and that limit is reached. |

Any other message is explained on [Errors and what to do](https://docs.xpander.ai/run/llm-gateway/errors.md).

## When your plan hits its limit

Your plan's own usage limits apply. When one is reached, [AI models & keys](https://chat.xpander.ai/?settings=my-gateway) shows until when, for example *Your Claude plan's usage limit is reached until Thu, Oct 8, 8:00 AM. Calls use company models until then.*

Until the plan resets:

* By default your calls **continue on company models** until the plan resets: your organization's key, or xpander's on xpander cloud. Those calls count toward your budgets.
* To wait for your plan instead, set **When my Claude plan hits its limit** to **Pause** in AI models & keys. Calls are then refused with the reset time until the plan resets.
* When your organization pauses plan calls for everyone, the choice is locked: *Your admin set calls to pause when a plan hits its limit*.

The full order is on [Licenses and who pays](https://docs.xpander.ai/run/llm-gateway/which-key-pays.md).

## Stop using your plan

Remove `ANTHROPIC_CUSTOM_HEADERS` from Claude Code's settings and set it up with your xpander key instead ([Connect your tools](https://docs.xpander.ai/run/llm-gateway/connect-tools#claude-code)), or run `/logout` in Claude Code.


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