通过中转服务使用 Claude Code 时,需要设置多个环境变量将请求指向自定义接入点。

参考文档:https://docs.newapi.pro/zh/docs/apps/claude-code

macOS / Linux

1curl -fsSL https://raw.githubusercontent.com/QuantumNous/new-api-docs/refs/heads/main/helper/claude-cli-setup.sh | bash

Windows(PowerShell)

1iex (irm 'https://raw.githubusercontent.com/QuantumNous/new-api-docs/refs/heads/main/helper/claude-cli-setup.ps1')

设置后,所有模型请求(包括官方预设模型)均走自定义接入点,不消耗官方账号额度。