# Claude Code Quick Start

## Prerequisite: install Node.js

Complete the [Node.js Installation Guide](https://en-guide.anyroute.io/9233269m0.md), then verify:

```bash
node --version
npm --version
```

## 1. Install Claude Code

```bash
npm install --global @anthropic-ai/claude-code
```

Verify the installation:

```bash
claude --version
```

If npm reports a permissions error, use a Node.js version manager or configure a user-owned npm global prefix. Avoid running npm as `root`.

## 2. Create an AnyRoute API key

1. Sign in to the [AnyRoute API Keys page](https://cc.anyroute.io/keys).
2. Select **Create Key**.
3. Enter a name and select the Claude-compatible group and billing multiplier you need.
4. Optionally configure IP restrictions, a spending limit, a rate limit, and an expiration date.

![Open the API Keys page](https://api.apifox.com/api/v1/projects/8582374/resources/675907/image-preview)

![Create a Claude-compatible key](https://api.apifox.com/api/v1/projects/8582374/resources/675908/image-preview)

> An API key is an account credential. Never commit it to a repository or share it publicly.

## 3. Configure Claude Code

### Option A: CC Switch (recommended)

Download CC Switch from the [GitHub Releases page](https://github.com/farion1231/cc-switch/releases), then select **Import to CCS** in AnyRoute and enable the imported Claude configuration.

![Import the Claude configuration into CC Switch](https://api.apifox.com/api/v1/projects/8582374/resources/675911/image-preview)

![Enable the imported configuration](https://api.apifox.com/api/v1/projects/8582374/resources/675912/image-preview)

> In the current screenshots, “导入到 CCS” means **Import to CCS**, and “启用” means **Enable**.

### Option B: environment variables

Copy the API key from the AnyRoute console:

![Copy the API key](https://r2.bozhouai.com/dragoncode/file-20260317103239907.png)

Set the following values for the current terminal session.

Windows PowerShell:

```powershell
$env:ANTHROPIC_BASE_URL = "https://cc.anyroute.io"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_API_KEY"
```

macOS or Linux:

```bash
export ANTHROPIC_BASE_URL="https://cc.anyroute.io"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
```

For regular use, prefer CC Switch or your operating system's secure credential-management method. If you persist these values in a shell profile or user environment, remember that the API key may be stored as plaintext.

## 4. Start Claude Code

Open a terminal in your project directory and run:

```bash
claude
```

Claude Code starts with the current directory as its workspace.

## Troubleshooting

### `claude` is not recognized

Run `npm prefix --global`, make sure the corresponding executable directory is on `PATH`, then open a new terminal.

### The connection fails or returns HTTP 401

Check that:

- `ANTHROPIC_BASE_URL` is exactly `https://cc.anyroute.io`.
- `ANTHROPIC_AUTH_TOKEN` is set in the same terminal session.
- The key is active, unexpired, and assigned to a Claude-compatible group.

### How do I switch models or billing groups?

Create a key for the required group in the [AnyRoute console](https://cc.anyroute.io/keys), then switch profiles in CC Switch or update the environment variable in your current terminal.

