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

# Connect your AI subscription

> Connect one of the 13 AI providers that your squad can run on, and add or replace accounts later in AI Tokens.

Your agents run on your own AI accounts. You connect a subscription or an API key from one of 13 providers, and your provider bills you for model usage. Squad does not sell model usage. The credentials are stored on your workspace computer.

You connect your first provider during setup. After setup, you add, replace, and remove accounts in AI Tokens. You can connect more than one provider and more than one account per provider.

## Before you start

* An account with one of the providers below, on the plan or key type in the table.
* For **Claude** and **Claude Code** only: a terminal on your own computer, to run the command that creates a setup token. The `npx` command needs Node.js.
* For **ChatGPT** only: in ChatGPT, open **Settings** > **Security** and turn on **Enable device code authorization for Codex**.

## Providers and what they bill

The cards appear in this order on the setup page and in AI Tokens.

| Card                      | How you connect | What it uses and bills                                                                                                                                     |
| ------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ChatGPT · Codex**       | Device code     | Your ChatGPT plan. The setup page describes it as "Flat-rate · Pro subscription" and marks it **Recommended**.                                             |
| **Claude Code**           | Setup token     | Your Claude subscription, through the Claude Code CLI on your workspace computer. The card says that it uses plan limits only and never bills extra usage. |
| **Grok**                  | OAuth           | Your SuperGrok or X Premium subscription. No API key and no per-token billing.                                                                             |
| **Z.ai**                  | API key         | Your GLM Coding Plan.                                                                                                                                      |
| **Kimi**                  | API key         | Your kimi.com subscription. Usage draws from your plan's Kimi Code credits.                                                                                |
| **MiniMax**               | OAuth           | Your MiniMax Coding Plan.                                                                                                                                  |
| **Gemini**                | API key         | Your Google AI Studio account, which has a free tier.                                                                                                      |
| **GitHub Copilot**        | Device code     | Your active Copilot subscription. No API key and no per-token billing.                                                                                     |
| **OpenRouter**            | API key         | Your OpenRouter balance.                                                                                                                                   |
| **Qwen Cloud**            | API key         | Your Qwen coding plan's included quota.                                                                                                                    |
| **Cloudflare Workers AI** | API token       | Your Cloudflare account. It runs open models.                                                                                                              |
| **OpenCode**              | API key         | Your OpenCode Zen account, pay per use.                                                                                                                    |
| **Claude**                | CLI setup token | Your Claude account at Anthropic. See the **Claude** tab in [Steps for each provider](#steps-for-each-provider) for how usage counts.                      |

For the credits that Squad charges for research tools, see [What Squad costs and what uses credits](/docs/costs). Credits never pay for model usage.

## Connect during setup

On the setup page, you pick one card under **Choose your AI provider**, tick the Terms box, and click **Launch my squad**. When you connect depends on the card:

* **Claude** and **Z.ai**: you paste the token or key on the setup page, before you click **Launch my squad**. For Claude, the Terms box and **Launch my squad** appear only after you paste a token.
* **ChatGPT · Codex** and **MiniMax**: the connection starts by itself on the success screen, after the build finishes.
* All other cards show "Connects after setup". On the success screen, click **Connect** followed by the provider name. The same window as in AI Tokens opens. Follow the steps for your provider below.

On the success screen, **Skip for now** and **Skip to Dashboard** let you continue without a connection. Your agents cannot work until you connect an account in AI Tokens.

The card that you pick at setup also sets your workspace's default model.

## Connect or add an account in AI Tokens

<Steps>
  <Step title="Open AI Tokens">
    Open **AI Tokens**. Use the key icon at the bottom of the sidebar, the account menu, or **Settings** > **AI Tokens**.
  </Step>

  <Step title="Choose the provider">
    * If the provider has no account yet, click its card under **ADD A PROVIDER**.
    * If the provider already has an account, click **＋ Add account** on its card.
  </Step>

  <Step title="Name the account">
    In **Token name**, type a name for this account, for example `personal` or `work`. The part before the colon is fixed. Use a different name for each account of the same provider.
  </Step>

  <Step title="Complete the provider steps">
    Complete the steps for your provider in the next section.
  </Step>
</Steps>

The window closes when the account is connected. The account appears as a row on the provider's card.

## Steps for each provider

<Tabs>
  <Tab title="ChatGPT">
    1. In ChatGPT, turn on **Enable device code authorization for Codex** in **Settings** > **Security**, if you did not do it before.
    2. On the **ChatGPT · Codex** card, click **Connect OpenAI account**.
    3. Under **1 · Copy this code**, copy the code.
    4. Under **2 · Open this link and paste the code there**, open the link, paste the code, and approve.

    The window shows **Waiting for you to authorize…** until you approve. The code is valid for 5 minutes. The connection renews by itself. The account row shows when it expires and **renews automatically**.
  </Tab>

  <Tab title="Claude Code">
    1. On your own computer, open a terminal and run `claude setup-token`. If you do not have Claude Code installed, run `npx @anthropic-ai/claude-code setup-token`.
    2. Approve in the browser window that opens.
    3. Copy the token that the terminal prints. It starts with `sk-ant-oat01-`. If the terminal wraps it onto two lines, copy all of it. Squad removes spaces and line breaks from the pasted token.
    4. On the **Claude Code** card, paste the token in **2 · Paste the setup token**.
    5. Optional: type the Claude account's email in **3 · Account email**. The token cannot show which account created it, so the email labels the row.
    6. Click **Connect**.

    Squad checks the token with a real test turn on your workspace computer before it saves it. A regular Anthropic API key does not work here.

    With more than one Claude Code account, one account is active and the others are on standby. The newest connection becomes the active one. When the active account reaches its usage limit, Squad makes the next account in the order active, and that account shows **IN USE**. If the run that hit the limit had not done any work yet, Squad runs it again on the new account. A run that had already started working is not repeated, and the next run uses the new account. The account that ran out is skipped until its limit resets. To choose the active account yourself, move it to the top of the card and save the order.
  </Tab>

  <Tab title="Grok">
    1. On the **Grok** card, click **Sign in with Grok**.
    2. Copy the code, open the link, and approve on grok.com.

    Your squad refreshes the connection automatically. Grok cannot connect with a pasted key.
  </Tab>

  <Tab title="Z.ai">
    1. Subscribe to the GLM Coding Plan at z.ai.
    2. In your Z.ai dashboard, open **API Keys** and create a key.
    3. On the **Z.ai** card, paste the key in **API key** and click **Connect**.
  </Tab>

  <Tab title="Kimi">
    1. Open the Kimi Code Console with your kimi.com subscription and generate a key. The console allows up to 5 keys.
    2. On the **Kimi** card, paste the key in **API key** and click **Connect**. Kimi subscription keys start with `sk-kimi-`.
  </Tab>

  <Tab title="MiniMax">
    1. On the **MiniMax** card, click **Connect with MiniMax**. The MiniMax window has no **Token name** field.
    2. Open the link that the window shows and approve access on MiniMax.
  </Tab>

  <Tab title="Gemini">
    1. Create a key at aistudio.google.com/apikey (Google AI Studio).
    2. On the **Gemini** card, paste the key in **API key** and click **Connect**. Keys can start with `AIza` or `AQ.`.

    Gemini connects only with an AI Studio API key. There is no Google sign-in. Squad checks the key before it saves it.
  </Tab>

  <Tab title="GitHub Copilot">
    1. On the **GitHub Copilot** card, click **Sign in with GitHub**.
    2. Copy the code, open the link, and enter the code on github.com.

    You need an active Copilot subscription. After you connect, the model lists show the models that your Copilot plan includes. Copilot cannot connect with a pasted token.
  </Tab>

  <Tab title="OpenRouter">
    1. Create a key at openrouter.ai/keys.
    2. On the **OpenRouter** card, paste the key in **API key** and click **Connect**. OpenRouter keys start with `sk-or-`.

    Squad checks the key before it saves it.
  </Tab>

  <Tab title="Qwen Cloud">
    1. Create a key at home.qwencloud.com/api-keys with your Qwen coding plan.
    2. On the **Qwen Cloud** card, paste the key in **API key**. Qwen Cloud keys start with `sk-`.
    3. Optional: paste your plan's base URL in **Base URL**. The API keys page shows it next to the key. Leave it empty to use the default.
    4. Click **Connect**.

    Squad checks the key with a real call. Extra keys must come from the same plan. When one key hits its limit, the next key takes over.
  </Tab>

  <Tab title="Cloudflare Workers AI">
    1. Create an API token at dash.cloudflare.com/profile/api-tokens with the Workers AI permission.
    2. Copy your Account ID. It is the 32-character ID on your Cloudflare dashboard's overview page.
    3. On the **Cloudflare Workers AI** card, paste the token in **API token** and the ID in **Account ID**.
    4. Click **Connect**.

    Squad checks the token against your account with a real call. Extra tokens on the same workspace must use the same Account ID.
  </Tab>

  <Tab title="OpenCode">
    1. Sign in at opencode.ai, open **API Keys**, and create a key.
    2. On the **OpenCode** card, paste the key in **API key** and click **Connect**.
  </Tab>

  <Tab title="Claude">
    The **Claude** card connects your Claude account directly, not through the Claude Code CLI.

    1. On your own computer, open a terminal and run `npx @anthropic-ai/claude-code setup-token`.
    2. Approve in the browser window that opens.
    3. Copy the token that the terminal prints. It starts with `sk-ant-oat01-`.
    4. On the **Claude** card, paste the token in **2 · Paste the setup token** and click **Connect**.

    At setup, you paste this token on the setup page instead.

    How usage counts: Squad sends your agents' requests directly to Anthropic with this token. The account row shows your plan's usage limits. Anthropic, not Squad, decides whether this usage counts against your plan's included limits or is billed as Extra Usage. Check your usage at claude.ai/settings/usage before you rely on this card for steady work. If you want your Claude subscription to stay within its plan limits, use **Claude Code** instead.
  </Tab>
</Tabs>

## Replace or remove an account

To reconnect an account, for example after it expired:

1. On the account's row, click **Replace**.
2. Complete the steps for the provider. The window is titled **Replace** followed by the account name. The name is locked, so the new login overwrites exactly this account.

To remove an account, click **Disconnect** on its row.

<Warning>
  **Disconnect** removes the account at once. There is no confirmation step. If it was the only account for a provider, runs that use that provider's models fail until you connect an account again.
</Warning>

## Use more than one account

Each provider card can hold several accounts. With two or more accounts, the card lists them highest first, and Squad tries them in that order. Use the up and down arrows to change the order, then click **Save changes**. The order is the fallback order inside that provider. Claude Code is different: one account is active at a time, and the next account takes over when the active one reaches its usage limit. If every Claude Code account is at its limit, Claude Code cannot serve runs until one resets. Runs then move to the next model in **Model routing**, if you set a fallback. For how long an account is skipped, see [Limits and defaults](/docs/limits-and-defaults#runs).

Connecting an account does not change which model your agents use. To run your agents on a newly connected provider, set one of its models as the default or as a fallback. See [Choose models and manage AI accounts](/docs/ai-accounts).

## Check that it works

* The account appears as a row on the provider's card with a status word, for example **CONNECTED** or **IN USE**. See [Statuses and what they mean](/docs/statuses).
* Send a message to your lead in chat. A reply means your agents can reach the model.

## Troubleshooting

**The window shows "Authorization timed out. Please try again."**
Cause: you did not approve the device code within 5 minutes.
Fix: close the window and start again. You get a new code.

**The ChatGPT connection does not complete after you paste the code.**
Cause: device code authorization can be off in your ChatGPT account. Squad asks you to turn it on before you connect.
Fix: in ChatGPT, open **Settings** > **Security** and turn on **Enable device code authorization for Codex**. Then connect again.

**The name field says the account "is already connected. Connecting would overwrite it."**
Cause: an account with the same token name exists on this card.
Fix: type another name, or click **Replace** on the existing account.

**Claude says "Token must start with sk-ant-oat01-".**
Cause: you pasted something other than a setup token, for example an API key or a partial token.
Fix: run the setup-token command again and copy the whole token.

**Claude Code refuses the token.**
Cause: Claude Code accepts only a setup token that starts with `sk-ant-oat01-`. It refuses API keys.
Fix: run `claude setup-token` and paste its output.

**A red banner says a provider "is signed out on your workspace".**
Cause: the login for that provider stopped working. Runs that use it fail.
Fix: click **Replace** on the account and sign in again.

**A ChatGPT row says "automatic renewal failed - reconnect this account".**
Cause: the ChatGPT login can no longer renew itself.
Fix: click **Replace** on that row and connect again.

**Chat shows "Your AI connection expired. Replies will fail until you reconnect."**
Cause: the account that serves your agents expired.
Fix: click **Reconnect** or **Reconnect in AI Tokens**, then **Replace** the expired account.

**You skipped the connection at setup and your agents do not reply.**
Cause: no AI account is connected.
Fix: connect an account in AI Tokens with the steps on this page.

For other setup errors, see [Fix setup problems](/docs/setup-troubles).
