白嫖claude code免费镜像国内中转使用教程,cursor的免费替代方案

657 阅读1分钟

国内免费使用 Claude Code 操作步骤 安装使用教程 支持Windows /Macos /Linux

国内用户可以通过 AnyRouter 提供的 API 中转服务,实现免费使用。下面是具体步骤:

1.API中转服务 国内镜像

通过注册Any Router,即可获得免费额度100$

通过邀请连接注册(额外赠送50$,默认送50):anyrouter.top/register?af…

支持Linux DO 不用注册 直接登录 image.png image.png

2.添加API令牌

  • 进入“API 令牌”页面,点击“添加令牌”。

  • 在名称栏填写易记的名称,例如“Key1”

  • 点击“提交”,复制生成的 API Key,以备后续使用(以 sk- 开头,令牌后面要用)

3.安装 Node.js

确保 Node.js 版本 ≥ 18.0

# windows 用户
## 下载链接https://nodejs.org/dist/v22.17.0/node-v22.17.0-x64.msi
## 现在完成后直接安装

# Ubuntu / Debian 用户

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -

sudo apt-get install -y nodejs

node --version

# macOS 用户

sudo xcode-select --install

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

brew install node

node --version

4.安装 Claude Code

# Windows/linux/macos 执行
npm install -g @anthropic-ai/claude-code

claude --version

5.配置环境变量

  • windows设置系统环境

    1.变量名ANTHROPIC_AUTH_TOKEN 变量值sk-(第1步 自己的API key)

    2.ANTHROPIC_BASE_URL 变量值anyrouter.top

## 通过CMDs设置 打开 CMD 终端,执行以下命令:

set ANTHROPIC_AUTH_TOKEN=你的API密钥
set ANTHROPIC_BASE_URL=https://anyrouter.top
  • macos/linux

    可将环境变量写入 ./bash_profile /.bashrc /.zshrc


echo -e '\n export ANTHROPIC_AUTH_TOKEN=sk-...' >> ~/.bash_profile

echo -e '\n export ANTHROPIC_BASE_URL=https://anyrouter.top' >> ~/.bash_profile

echo -e '\n export ANTHROPIC_AUTH_TOKEN=sk-...' >> ~/.bashrc

echo -e '\n export ANTHROPIC_BASE_URL=https://anyrouter.top' >> ~/.bashrc

echo -e '\n export ANTHROPIC_AUTH_TOKEN=sk-...' >> ~/.zshrc

echo -e '\n export ANTHROPIC_BASE_URL=https://anyrouter.top' >> ~/.zshrc

6. 使用 Claude Code


## 在终端的项目目录下运行:

cd your-project-folder

claude


## 在vscode项目目录下运行:

claude

image.png