Skip to content

Claude Code 一键脚本

公共 installer 会在缺少 claude 命令时调用 Anthropic 官方安装器,然后把 AI通道 endpoint、 API Key 和 onboarding 状态安全合并到本机配置。脚本不会使用品牌静态域名。

运行前准备

先在 aitongdao.com 注册、充值并创建 sk- 开头的令牌。 Claude Code 建议选择 ccmax 分组。交互命令不会把 Key 写进 shell history,运行时再安全输入。

  • macOS、Linux、WSL:系统至少有 nodepython3 其中一个,用于安全合并 ~/.claude.json;不要求 Node.js 22+
  • Windows PowerShell:不要求预先安装 Node.js

macOS / Linux / WSL

bash
curl -fsSL https://gh.auranaiss-dev.com/ding-rs/ai-cli-installers/releases/latest/download/claude-code.sh \
  | bash -s -- --endpoint https://ai.aitongdao.com

脚本随后提示输入 API Key,输入不会回显。如果检测到已经安装 Claude Code,会询问是否重装或 更新;选择否只跳过官方安装步骤,endpoint 和 Key 配置仍会更新。

Windows PowerShell

在 PowerShell 5.1 或更高版本中先下载脚本,再执行:

powershell
$installer = Join-Path $env:TEMP ("claude-code-{0}.ps1" -f [guid]::NewGuid().ToString('N'))
try {
  Invoke-WebRequest -UseBasicParsing -Uri 'https://gh.auranaiss-dev.com/ding-rs/ai-cli-installers/releases/latest/download/claude-code.ps1' -OutFile $installer
  powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File $installer -Endpoint https://ai.aitongdao.com
} finally {
  Remove-Item -LiteralPath $installer -Force -ErrorAction SilentlyContinue
}

命令保留交互输入,PowerShell 脚本会安全提示输入 Key,并在发现已有安装时询问是否重装。 GUID 临时文件名避免并行运行时互相覆盖,finally 会按原样路径清理脚本。

脚本会修改什么

  • 缺少 Claude Code 时调用官方 https://claude.ai/install.shinstall.ps1
  • macOS/Linux/WSL 在 shell rc 的受管区块写入 ANTHROPIC_BASE_URLANTHROPIC_AUTH_TOKEN;Windows 写入用户级环境变量。
  • 合并 ~/.claude.json,把 hasCompletedOnboarding 设为 true,保留其他字段。
  • 替换已有配置前创建带编号的 .ai-cli-installers.bak 备份;配置失败时尝试自动回滚。

验证

macOS/Linux/WSL 重新打开终端,Windows 重新打开 PowerShell,然后运行:

bash
claude --version
claude doctor
claude

Anthropic endpoint 必须是 https://ai.aitongdao.com,不要追加 /v1

常见问题

想保留当前版本,不重新安装

在重装询问处选择否即可。installer 仍会更新接入配置。

想先检查,不写文件

下载脚本后执行并追加 --dry-run;PowerShell 使用 -DryRun。dry-run 仍需要 endpoint 和 Key, 建议让脚本交互询问 Key,不要把真实 Key 写在命令参数中。

Windows 使用 WSL

在 WSL 终端运行上面的 Bash 命令。纯 Windows 环境使用 PowerShell 资产,不需要 Git Bash。

AI通道 · 让国内开发者直连全球 AI 模型