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

# CC Switch (multi-tool switcher)

> Use CC Switch to point Claude Code, Codex, OpenClaw and more at FortAPI with one click

[CC Switch](https://github.com/farion1231/cc-switch) is a cross-platform desktop app that manages configurations for **Claude Code, Codex, Gemini CLI, OpenCode, and OpenClaw**. One GUI to switch all of them between providers — no need to hand-edit `~/.claude/settings.json`, `~/.codex/config.toml`, or `~/.openclaw/openclaw.json`.

<Note>
  If you only use one CLI (say, Claude Code), you can skip CC Switch and follow [Claude Code direct setup](/en/integrations/claude-code). CC Switch shines when you juggle **multiple tools** and **multiple providers**.
</Note>

## Prerequisites

<Steps>
  <Step title="Create an API key">
    Console → **Tokens** → **Create token**. Copy the `sk-...` string. Details in [API keys & security](/en/authentication).
  </Step>

  <Step title="Install at least one CLI">
    CC Switch doesn't install Claude Code / Codex / etc. — it only manages their configs. Install your CLI first via [Claude Code](/en/integrations/claude-code) or [Codex](/en/integrations/codex).
  </Step>
</Steps>

## Install CC Switch

Grab a build from the [Releases page](https://github.com/farion1231/cc-switch/releases/latest):

<Tabs>
  <Tab title="macOS">
    Download `cc-switch-x.y.z-arm64.dmg` (Apple Silicon) or `cc-switch-x.y.z-x64.dmg` (Intel) → double-click to mount → drag `CC Switch.app` into **Applications**.

    <Note>
      If you see "cannot verify developer" on first launch, go to **System Settings → Privacy & Security**, scroll down, and click **Open Anyway**.
    </Note>
  </Tab>

  <Tab title="Windows">
    Download `cc-switch-x.y.z-x64-setup.exe` → run the installer → a CC Switch icon will appear on your desktop.
  </Tab>

  <Tab title="Linux">
    Download `cc-switch_x.y.z_amd64.deb` (Debian/Ubuntu) or `cc-switch-x.y.z.AppImage` (others).

    ```bash theme={null}
    # Debian / Ubuntu
    sudo dpkg -i cc-switch_*_amd64.deb

    # AppImage
    chmod +x cc-switch-*.AppImage
    ./cc-switch-*.AppImage
    ```
  </Tab>
</Tabs>

## Add FortAPI to CC Switch (Claude Code)

Open CC Switch, select the **Claude Code** tab on the left:

<Steps>
  <Step title="Click 'Add Provider'">
    The **+ Add Provider** button is at the top-right of the main window.
  </Step>

  <Step title="Choose 'Custom Provider'">
    Scroll to the bottom of the preset list and pick **Custom Provider**. If "FortAPI" already shows up as a preset, pick it directly — only the API key needs filling in.
  </Step>

  <Step title="Basic info">
    | Field       | Value                             |
    | ----------- | --------------------------------- |
    | **Name**    | `FortAPI`                         |
    | **Website** | `https://www.fortapi.com`         |
    | **Icon**    | Optional, leave blank for default |
  </Step>

  <Step title="Environment variables">
    Switch to the **Environment Variables** (or **Endpoint config**) tab:

    | Variable                                | Value                     |
    | --------------------------------------- | ------------------------- |
    | `ANTHROPIC_BASE_URL`                    | `https://www.fortapi.com` |
    | `ANTHROPIC_API_KEY`                     | `sk-your-FortAPI-token`   |
    | `ANTHROPIC_MODEL` (optional)            | `your-model-name`         |
    | `ANTHROPIC_SMALL_FAST_MODEL` (optional) | `your-model-name`         |

    Replace `your-model-name` with any model name from the pricing page on the main site.

    <Warning>
      Do **not** append `/v1` to `ANTHROPIC_BASE_URL`. The Anthropic SDK adds `/v1/messages` automatically — an extra `/v1` causes 404s.
    </Warning>
  </Step>

  <Step title="Save and enable">
    Click **Save** → back on the main screen, click **Enable** on the FortAPI row. Green status = Claude Code is now routed through FortAPI.
  </Step>
</Steps>

## Add FortAPI to CC Switch (Codex)

Switch to the **Codex** tab on the left and repeat the add flow, but use these env vars:

| Variable                  | Value                                    |
| ------------------------- | ---------------------------------------- |
| `OPENAI_BASE_URL`         | `https://www.fortapi.com/v1`             |
| `OPENAI_API_KEY`          | `sk-your-key` (same token works)         |
| `OPENAI_MODEL` (optional) | `your-model-name` (see the pricing page) |

<Note>
  Codex uses the OpenAI-compatible protocol, so `OPENAI_BASE_URL` **must** end in `/v1`.
</Note>

## Verify the switch

After switching in CC Switch, behavior differs per tool:

<CardGroup cols={2}>
  <Card title="Claude Code" icon="terminal">
    **No restart needed** — CC Switch hot-swaps. Just keep typing in your open `claude` session.
  </Card>

  <Card title="Codex / OpenClaw / Gemini CLI" icon="rotate">
    **Close and reopen** the terminal (or restart the CLI) so the new env vars are picked up.
  </Card>
</CardGroup>

A quick smoke test:

```bash theme={null}
# Claude Code
claude "In one sentence, which API are you using?"

# Codex
codex "In one sentence, which API are you using?"
```

A normal reply with no 401 / network error = success.

## Switch back to the official provider

In CC Switch's main UI, pick another provider → click **Enable**. CC Switch rewrites the relevant config files.

<Tip>
  You can keep FortAPI, the official Anthropic/OpenAI account, and other relays all listed at the same time and switch with one click. That's CC Switch's main payoff.
</Tip>

## Troubleshooting

<AccordionGroup>
  <Accordion title="After switching, Claude Code still hits the old endpoint">
    1. Close the current `claude` session and open a fresh terminal.
    2. Check whether you manually `export`ed `ANTHROPIC_BASE_URL` anywhere — shell-level env vars override the settings file CC Switch writes.
    3. Run `cat ~/.claude/settings.json` and confirm the `env` block contains FortAPI's config.
  </Accordion>

  <Accordion title="401 Unauthorized">
    * Verify `ANTHROPIC_API_KEY` was copied completely (the `sk-` prefix and every trailing character).
    * In the FortAPI Console → **Tokens**, confirm the key is enabled and that the "allowed models" allowlist (if any) includes the model you're using.
    * Check your USD balance.
  </Accordion>

  <Accordion title="404 / model not found">
    * Typo in the model ID. Common Claude families on FortAPI: `claude-sonnet`, `claude-opus`, `claude-haiku`.
    * Don't append `/v1` to `ANTHROPIC_BASE_URL`.
  </Accordion>

  <Accordion title="CC Switch can't find Claude Code's config">
    Make sure Claude Code has been run at least once (so `~/.claude/settings.json` exists). With Claude Code not installed, CC Switch has nothing to switch.
  </Accordion>
</AccordionGroup>

## Next steps

* **Configure Claude Code directly (no CC Switch)?** See [Claude Code direct setup](/en/integrations/claude-code).
* **Configure Codex directly?** See [Codex setup](/en/integrations/codex).
* **Configure OpenClaw?** See [OpenClaw setup](/en/integrations/openclaw).
