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

# Claude Code

> Claude Code 配置教程

## 环境准备

<Info>
  请先完成 [环境配置](/environment/setup)，确保 Node.js 已正确安装
</Info>

## 安装

<Tabs>
  <Tab title="macOS">
    **方法一：Homebrew（推荐）**

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

    **方法二：Native Install**

    ```bash theme={null}
    curl -fsSL https://claude.ai/install.sh | bash
    ```
  </Tab>

  <Tab title="Windows">
    **方法一：Native Install（推荐）**

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

    **方法二：WinGet（Windows 原生包管理器）**

    ```powershell theme={null}
    winget install Anthropic.ClaudeCode
    ```
  </Tab>

  <Tab title="Linux">
    **方法一：Native Install（推荐）**

    ```bash theme={null}
    curl -fsSL https://claude.ai/install.sh | bash
    ```
  </Tab>
</Tabs>

## 配置

编辑配置文件：

* **macOS/Linux**：`~/.claude/settings.json`
* **Windows**：`C:\Users\你的用户名\.claude\settings.json`

```json theme={null}
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your-api-key-here",
    "ANTHROPIC_BASE_URL": "https://code.rayinai.com",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "permissions": {
    "allow": [],
    "deny": []
  }
}
```

<Warning>
  将 `your-api-key-here` 替换为你的 API Key
</Warning>

## 使用

在终端运行 `claude`，看到对话界面并能正常回复即表示配置完成

```bash theme={null}
claude
```

<img src="https://mintcdn.com/zller/B4dE7O3I3qDrpqQ7/images/claude-code-running.png?fit=max&auto=format&n=B4dE7O3I3qDrpqQ7&q=85&s=f0f4d766e159eeaa96abcb0f11b9fcfc" alt="Claude Code 运行界面" width="2386" height="850" data-path="images/claude-code-running.png" />

## 遇到问题

<Card title="Claude Code 常见问题" icon="circle-question" href="/claude-code/faq">
  查看 Claude Code 配置相关的常见问题
</Card>
