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

# Claude Code setup

> Install Claude Code and connect it to NexusAPI using its native Anthropic configuration.

Claude Code is a terminal coding agent. It uses the native Anthropic Messages configuration, so its NexusAPI Base URL is `https://nexusapi.link` — **do not append `/v1`**.

## 1. Install Claude Code

Use an official installer. A native installation does not require Node.js.

### macOS, Linux, or WSL

```bash theme={"system"}
curl -fsSL https://claude.ai/install.sh | bash
```

### Windows PowerShell

```powershell theme={"system"}
irm https://claude.ai/install.ps1 | iex
```

You may also use WinGet on Windows or Homebrew on macOS:

```powershell theme={"system"}
winget install Anthropic.ClaudeCode
```

```bash theme={"system"}
brew install --cask claude-code
```

Verify the installed client before editing configuration:

```bash theme={"system"}
claude --version
claude doctor
```

## 2. Create a NexusAPI key

In the [NexusAPI console](https://nexusapi.link), open **Token Management → Add token**. Give the key a recognizable name, choose a Claude-compatible group that contains the model you need, and set an appropriate limit.

Do not assume every Claude-branded model is available to every group; verify it in the Model Marketplace or with `/v1/models`.

## 3. Set user-level configuration

Claude Code reads user settings from:

| System              | File                                  |
| ------------------- | ------------------------------------- |
| macOS / Linux / WSL | `~/.claude/settings.json`             |
| Windows             | `%USERPROFILE%\.claude\settings.json` |

Create it on macOS, Linux, WSL, or Git Bash:

```bash theme={"system"}
mkdir -p ~/.claude
touch ~/.claude/settings.json
```

On Windows PowerShell:

```powershell theme={"system"}
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude"
notepad "$env:USERPROFILE\.claude\settings.json"
```

Merge the following `env` values into an existing file; do not overwrite your MCP, permissions, or other settings.

```json theme={"system"}
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "YOUR_NEXUSAPI_KEY",
    "ANTHROPIC_BASE_URL": "https://nexusapi.link"
  }
}
```

Keep this in your user directory, not in a project repository. Never commit or screenshot a real key.

<Tip>
  **Only disable experimental fields when the error asks for it**

  If an error explicitly mentions unsupported `context_management` or experimental inputs, add `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` to `env` and test again. It disables some preview fields and is not a default setting for every user.
</Tip>

## 4. Start and verify

Open a new terminal, enter a project directory, and run:

```bash theme={"system"}
cd your-project-folder
claude
```

Run `/status` inside Claude Code. Confirm that **Anthropic base URL** is `https://nexusapi.link` and authentication comes from `ANTHROPIC_AUTH_TOKEN`, then send a short text message.

## Troubleshooting

### `Invalid API Key · Please run /login`

Confirm that both environment values are saved, the key itself is enabled, and the terminal was restarted. Do not solve this by editing Claude's internal login state files.

### `Unable to connect to Anthropic services`

Run `claude doctor`, check the JSON syntax in `settings.json`, then reopen the terminal. If it persists, save the original error, `claude --version`, and `claude doctor` output.

### `fetch failed`

First distinguish a model call from Claude Code's WebFetch feature.

1. Send a one-line normal prompt. If it succeeds, NexusAPI model calls are working; troubleshoot WebFetch under its own network and safety rules.
2. If all model calls fail, run `claude doctor` and use `/status` to confirm the Base URL is still `https://nexusapi.link`.
3. Check local DNS, firewall, corporate network, or an existing trusted proxy for access to `nexusapi.link`.
4. Open a fresh terminal and test once. For persistent failures, retain the version, doctor output, full error, and Request ID, then use the [self-check guide](/en/faq/self-check).

### The status says `offline`

Some auxiliary features check official or third-party services separately. Verify the actual gateway URL with `/status` and send a small text request before treating `offline` as an API outage.

## Official references

* [Claude Code installation](https://code.claude.com/docs/en/installation)
* [Claude Code environment variables](https://code.claude.com/docs/en/env-vars)
* [Claude Code gateway configuration](https://code.claude.com/docs/en/llm-gateway)
