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

# Claude Code

## What is Claude Code?

> [**Claude Code**](https://docs.anthropic.com/en/docs/claude-code) is a terminal-based AI development assistant created by Anthropic. It enables developers to accelerate coding workflows by using natural language to generate code, troubleshoot issues, refactor existing implementations, and perform a wide range of engineering tasks directly from the command line.

<Note>
  AGCloud provides a fully Anthropic-compatible API endpoint. Claude Code will display model names like `claude-sonnet-4-6`, but the actual model running behind the scenes is your chosen model (e.g., GLM-5, Kimi-K2.5, etc.).
</Note>

<Tip>
  With **AGCloud**, you can use **160+ AI models** from top providers (Claude, OpenAI, Gemini, GLM, Kimi, MiniMax, DeepSeek, and more) directly in Claude Code — all with a single API key and **no code changes** required.
</Tip>

## Two Ways to Use Claude Code

* **[CLI Installation](#step-1-install-claude-code-cli)**
* **[VS Code Extension Installation](/guides/claude-code-vscode)**

## Step 1: Installation

<Check>
  Requires Node.js 20+
</Check>

Install Claude Code via NPM:

```shellscript theme={null}
npm install -g @anthropic-ai/claude-code
```

Check if the installation was successful.

```shellscript theme={null}
claude --version # display version, e.g.: 2.x.x (Claude Code)
```

After installation, you can start with Claude Code AI.

```shellscript theme={null}
cd your-project
claude
```

<Note>
  During your first run, Claude Code will prompt you to log in to your Anthropic account. You can **skip this step**.
</Note>

## Step 2: Configure AGCloud API

### Quick Jump:

* [macOS/Linux(Ubuntu) configuration](#macos-linux-setup)
* [Windows configuration](#windows-setup)

<h3 id="macos-linux-setup">
  macOS/Linux Setup
</h3>

#### Environment Variables (Quick Setup)

<Note>
  Append the commands below to `~/.bashrc`, `~/.zshrc`, or `~/.profile` so they load automatically on every login.
</Note>

```shellscript theme={null}
export ANTHROPIC_BASE_URL=https://aiandgpu.com
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS='1'
export ANTHROPIC_AUTH_TOKEN=<YOUR_API_KEY>
export ANTHROPIC_MODEL='claude-sonnet-4-6'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5-20251001'
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6'
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-6'
```

#### Activate the Configuration

```shellscript theme={null}
# Run the command that matches your current shell
source ~/.bashrc
source ~/.zshrc
```

#### Model Configuration (settings.json)

On macOS/Linux, Claude Code stores its config in `~/.claude/settings.json`. Use it to persist all model mappings at once:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aiandgpu.com",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_API_KEY>",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001"
  }
}
```

<h3 id="windows-setup">
  Windows Setup
</h3>

#### Environment Variables (Quick Setup)

<Note>
  Run these commands in PowerShell. To persist them, add the lines to `$PROFILE` or configure them via **System Properties → Environment Variables**.
</Note>

```powershell theme={null}
$env:ANTHROPIC_BASE_URL = "https://aiandgpu.com"
$env:CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = "1"
$env:ANTHROPIC_AUTH_TOKEN = "<YOUR_API_KEY>"
$env:ANTHROPIC_MODEL = "claude-sonnet-4-6"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5-20251001"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "claude-sonnet-4-6"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "claude-opus-4-6"
```

#### Activate the Configuration

```powershell theme={null}
# Restart PowerShell or manually reload your profile
. $PROFILE
```

#### Model Configuration (settings.json)

On Windows the config file lives at `C:\\Users\\<USERNAME>\\.claude\\settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aiandgpu.com",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_API_KEY>",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001"
  }
}
```

<Tip>
  Keep `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS='1'` enabled for the best AWS Bedrock protocol compatibility. For every available variable, see [**Claude Code Env Vars**](https://code.claude.com/docs/en/env-vars).
</Tip>

<Warning>
  After editing `settings.json` manually, fully restart Claude Code (and any IDE plugins) to load the changes.
</Warning>

## Step 3: Choose Your Model

By default, Claude Code maps its internal model tiers to specific models. With AGCloud, you can customize which model powers each tier.

### Default Model Mapping

| Claude Code Tier      | Environment Variable              | Default Model               | Description                     |
| --------------------- | --------------------------------- | --------------------------- | ------------------------------- |
| `Opus (Heavy tasks)`  | ANTHROPIC\_DEFAULT\_OPUS\_MODEL   | `claude-opus-4-6`           | Complex reasoning, architecture |
| `Sonnet (Main)`       | ANTHROPIC\_DEFAULT\_SONNET\_MODEL | `claude-sonnet-4-6`         | Primary coding model            |
| `Haiku (Light tasks)` | ANTHROPIC\_DEFAULT\_HAIKU\_MODEL  | `claude-haiku-4-5-20251001` | Quick completions, small edits  |

## Model Configuration Examples

Add the following to `~/.claude/settings.json`:

### Use Claude Models

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aiandgpu.com",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_API_KEY>",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001"
  }
}
```

## Step 4: Start with Claude Code

After configuration, start Claude Code in your project directory:

```shellscript theme={null}
cd your-project
claude
```

You can now use natural language to interact with your codebase:

```text theme={null}
> Help me refactor the authentication module to use JWT tokens

> Find and fix the bug in the payment processing logic

> Write unit tests for the user service

> Explain the architecture of this project
```

<Note>
  Claude Code will show model names like `claude-sonnet-4-20250514` in the UI, but the actual model running is your configured AGCloud model (e.g., GLM-5, Kimi-K2.5, etc.). This is expected behavior.
</Note>

## Available Models

Below are the recommended coding models provided by AGCloud:

| **Model Name**              | **Use For**                               | **Speed**  |
| :-------------------------- | :---------------------------------------- | :--------- |
| `claude-opus-4-6`           | Complex reasoning, full-stack development | 🌟🌟🌟🌟🌟 |
| `claude-sonnet-4-6`         | Balanced coding, debugging                | 🌟🌟🌟🌟🌟 |
| `claude-haiku-4-5-20251001` | Quick completions, lightweight tasks      | 🌟🌟🌟🌟   |

<Tip>
  AGCloud supports **160+ models**. You can use any model from the [**model list**](https://aiandgpu.com/v1/models) as long as it supports the chat completions API.
</Tip>

## FAQ

### 1. How to switch models?

You can switch models at any time by updating the environment variables in `~/.claude/settings.json` and restarting Claude Code. Alternatively, set environment variables directly in your terminal before launching:

```shellscript theme={null}
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6
claude
```

### 2. Why does the UI still show “Claude” model names?

This behavior is intentional. Claude Code relies on Anthropic’s native model identifiers internally. AGCloud functions as a passthrough layer—it accepts requests using Claude model names and forwards them to the model you’ve configured. The underlying capabilities remain the same; only the displayed model name changes.

### 3. Manual config changes not taking effect?

If you edited `~/.claude/settings.json` manually:

1. **Close Claude Code completely** (not just the current session)
2. If using the IDE plugin, **restart the IDE**
3. Verify the JSON syntax is valid
4. Re-launch Claude Code

```shellscript theme={null}
# Verify your config
cat ~/.claude/settings.json | python3 -m json.tool
```

### **4. Recommended Claude Code version?**

We recommend using the latest stable version of Claude Code for the best compatibility:

```shellscript theme={null}
npm update -g @anthropic-ai/claude-code
```

### **5. Connection issues?**

If you encounter connection errors:

1. Verify your API key is valid: visit **AGCloud** [Dashboard](https://developer.aiandgpu.com/)
2. Check that `ANTHROPIC_BASE_URL` is set to `https://aiandgpu.com` (no trailing slash)
3. Test connectivity:

```shellscript theme={null}
curl https://aiandgpu.com/v1/messages \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":20,"messages":[{"role":"user","content":"Hi"}]}'
```

## Resources Links

* **AGCloud Dashboard**: [**developer.aiandgpu.com**](https://developer.aiandgpu.com)
* **Claude Code Official Docs**: [**docs.anthropic.com/claude-code**](https://docs.anthropic.com/en/docs/claude-code)
* **VS Code Claude Code Docs**: [**code.claude.com/docs/en/vs-code**](https://code.claude.com/docs/en/vs-code#extension-settings)
* **Node.js Download**: [**nodejs.org**](http://nodejs.org)
