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

# Claude Code with Global AI: CC Switch or Manual Setup

> Connect Claude Code CLI to Global AI using CC Switch for one-click setup or by configuring environment variables and settings.json.

Claude Code is Anthropic's official command-line coding assistant. This page shows how to point it at Global AI instead of the official API. Official docs: [docs.anthropic.com/en/docs/claude-code](https://docs.anthropic.com/en/docs/claude-code/quickstart).

<Note>
  Pick one of the two methods: **CC Switch** for a desktop GUI, **manual setup** if you are comfortable with terminals and config files.
</Note>

## Install Claude Code

Use the official native installer. No manual Node.js install is needed. Pick the command for your OS:

<CodeGroup>
  ```bash macOS / Linux / WSL icon=terminal theme={null}
  curl -fsSL https://claude.ai/install.sh | bash
  ```

  ```powershell Windows PowerShell icon=windows theme={null}
  irm https://claude.ai/install.ps1 | iex
  ```

  ```bat Windows CMD icon=windows theme={null}
  curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
  ```

  ```bash Windows winget icon=windows theme={null}
  winget install Anthropic.ClaudeCode
  ```

  ```bash macOS Homebrew icon=apple theme={null}
  brew install --cask claude-code
  ```
</CodeGroup>

<Tip>
  `npm install -g @anthropic-ai/claude-code` is officially marked **deprecated**. Use one of the native installs above. On Windows, also install **Git for Windows** so Claude Code can use the Bash tool.
</Tip>

After installation, verify with:

```bash Verify install icon=terminal theme={null}
claude --version
```

## Option 1: CC Switch (recommended)

CC Switch is a desktop tool for switching providers with one click. It supports both Claude Code and ChatGPT(Codex). Download: [github.com/farion1231/cc-switch/releases](https://github.com/farion1231/cc-switch/releases).

Global AI supports one-click import into CC Switch. Steps:

<Steps>
  <Step title="Create an API key">
    Sign in to Global AI, open **API keys** in the left menu (or go to [globalai.vip/keys](https://globalai.vip/keys)), and create a `sk-` key in the **Claude** group.
  </Step>

  <Step title="Open the CC Switch import menu">
    On the row of the new key, click the **...** button on the far right and choose **CC Switch**.
  </Step>

  <Step title="Fill in the import details">
    In the dialog:

    * **App**: choose `Claude Code`
    * **Name**: customize as needed
    * **Main model**: choose `claude-sonnet-5` (or a stronger model such as Opus)

    Confirm and click **Open CC Switch** at the bottom.
  </Step>

  <Step title="Confirm opening CC Switch">
    Confirm in the browser prompt to open the CC Switch application.
  </Step>

  <Step title="Import the configuration">
    In CC Switch, click **Import** and wait for the success message.
  </Step>

  <Step title="Start Claude Code">
    In your project directory, run `claude` to get started. In the chat, type `/model` to switch between Sonnet, Opus, and other models.
  </Step>

  <Step title="Verify the integration">
    Open [Usage logs](https://globalai.vip/usage-logs/common). A call that matches your test timestamp confirms it works.
  </Step>
</Steps>

## Option 2: Manual setup

<Steps>
  <Step title="Edit settings.json">
    Locate the config file for your OS (create if missing):

    * **Windows**: `%USERPROFILE%\.claude\settings.json`
    * **macOS / Linux**: `~/.claude/settings.json`

    Write the following (replace `ANTHROPIC_AUTH_TOKEN` with your `sk-` key):

    ```json settings.json icon=file-code theme={null}
    {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "replace with your sk- key",
        "ANTHROPIC_BASE_URL": "https://globalai.vip",
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
      },
      "permissions": {
        "allow": [],
        "deny": []
      }
    }
    ```
  </Step>

  <Step title="Set environment variables">
    In your terminal:

    ```bash Environment variables icon=terminal theme={null}
    export ANTHROPIC_BASE_URL="https://globalai.vip"
    export ANTHROPIC_AUTH_TOKEN="replace with your sk- key"
    ```

    <Tip>
      To make these persistent, add the two `export` lines to `~/.zshrc` or `~/.bashrc`.
    </Tip>
  </Step>

  <Step title="Restart and verify">
    Restart your terminal, run `claude` in a project directory, send a test message, and confirm the call in [Usage logs](https://globalai.vip/usage-logs/common).
  </Step>
</Steps>

## Verify configuration

In your terminal, run the commands below. Seeing `https://globalai.vip` in the output confirms the environment variables are set:

<CodeGroup>
  ```bash macOS / Linux icon=terminal theme={null}
  echo $ANTHROPIC_BASE_URL
  echo $ANTHROPIC_AUTH_TOKEN
  ```

  ```powershell Windows PowerShell icon=windows theme={null}
  echo $env:ANTHROPIC_BASE_URL
  echo $env:ANTHROPIC_AUTH_TOKEN
  ```

  ```bat Windows CMD icon=windows theme={null}
  echo %ANTHROPIC_BASE_URL%
  echo %ANTHROPIC_AUTH_TOKEN%
  ```
</CodeGroup>

After changing configuration, **restart your terminal** for it to take effect.

## Use inside an IDE

Once either method is working, install the UI extension to chat with Claude Code directly in VS Code, Cursor, or Trae.

<Steps>
  <Step title="Install the extension">
    Search **Claude Code** in the VS Code, Cursor, or Trae extension marketplace and install the official extension.
  </Step>

  <Step title="Open the chat panel">
    Open any project file, click the Claude icon in the top right of the editor, and the chat dialog appears.
  </Step>
</Steps>

<Note>
  Cursor and Trae cannot accept a Global AI key directly in their model configuration, but you can install Claude Code to integrate and use Agent features.
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Authentication error on call">
    Confirm you are using a `sk-` key from Global AI and that it has not expired. Edit or regenerate at [globalai.vip/keys](https://globalai.vip/keys).
  </Accordion>

  <Accordion title="Environment variables have no effect">
    After editing `~/.zshrc`, `~/.bashrc`, or system environment variables, **restart your terminal**. Use the commands in the "Verify configuration" section to check.
  </Accordion>

  <Accordion title="Model not found">
    Model IDs change over time. Use the current Claude model IDs shown on [globalai.vip/pricing](https://globalai.vip/pricing).
  </Accordion>
</AccordionGroup>

## References

* [Claude Code official docs](https://docs.anthropic.com/en/docs/claude-code/quickstart)
* [Global AI pricing](https://globalai.vip/pricing)


## Related topics

- [ChatGPT(Codex) with Global AI: CC Switch or Manual Setup](/en/clients/codex.md)
- [OpenCode & CC-Switch with Global AI: Integration Guide](/en/clients/opencode.md)
- [Global AI Client Integrations: Parameters and Selection](/en/clients/overview.md)
- [Cherry Studio with Global AI: Claude, GPT, Gemini Setup](/en/clients/cherry-studio.md)
- [ChatWise Setup: Unified Multi-Provider Access via Global AI](/en/clients/chatwise.md)
