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

# Claude Code

> 安装 Claude Code，从控制台复制配置，并合并到本地 settings.json

推荐通过 [CC Switch](https://docs.okab.ai/integrations/cc-switch.md) 导入配置，手动接入按以下步骤操作。使用 Claude Desktop 桌面应用时，见 [Claude Code Desktop](https://docs.okab.ai/integrations/claude-desktop)。

## 安装

> [tab] macOS / Linux / WSL
>
> ```bash theme={"system"}
> curl -fsSL https://claude.ai/install.sh | bash
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={"system"}
> irm https://claude.ai/install.ps1 | iex
> ```

安装后重新打开终端，运行 `claude --version`，系统要求见 [官方安装说明](https://code.claude.com/docs/en/setup)。

## 配置

在控制台对应服务的 **访问密钥** 列表中，点击 **使用 → 客户端配置**，选择 **Claude Code**，复制生成的配置。

配置文件为 `~/.claude/settings.json`，Windows 对应 `%USERPROFILE%\.claude\settings.json`。设置过 `CLAUDE_CONFIG_DIR` 时，使用该目录；WSL 使用 WSL 用户目录。

已有文件先备份，再把以下字段合并到原来的 `env` 对象，地址和密钥以控制台生成值为准。

```json theme={"system"}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.okab.ai",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_MELIAI_API_KEY>"
  }
}
```

地址不要追加 `/v1/messages`，密钥不要添加 `Bearer ` 前缀。保留其他设置，避免重复 JSON 对象。

## 验证

重启 Claude Code，在项目目录运行以下命令，再到 [仪表盘](https://console.okab.ai/usage) 的 **调用记录** 核对请求。

```bash theme={"system"}
claude -p "只回答 OK"
```

模型不可用或配置未生效时，查看 [常见问题](https://docs.okab.ai/troubleshooting.md)，更多设置见 [官方配置文档](https://code.claude.com/docs/en/settings)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.