在配置任何 CLI 工具前,请确保您已有可用的 API Key (令牌)。
* 请注意:大多数 CLI 工具要求地址必须包含 /v1 后缀。
推荐使用 cc-switch 简化配置操作
通过修改 Shell 配置文件实现永久生效。
# 如果使用 Zsh (macOS 默认)
nano ~/.zshrc
# 如果使用 Bash
nano ~/.bash_profile
在文件末尾添加以下行:
# Claude Code 配置
export CLAUDE_BASE_URL="https://cdn.omgcloud.top/v1"
# 通用 OpenAI 兼容工具配置 (如 aichat)
export OPENAI_API_BASE="https://cdn.omgcloud.top/v1"
export OPENAI_API_KEY="您的sk令牌"
source ~/.zshrc # 或对应的配置文件
针对 Windows 用户,推荐使用 PowerShell 进行配置。
$env:CLAUDE_BASE_URL = "https://cdn.omgcloud.top/v1"
$env:OPENAI_API_BASE = "https://cdn.omgcloud.top/v1"
运行以下命令将其保存到用户环境变量中:
[Environment]::SetEnvironmentVariable("CLAUDE_BASE_URL", "https://cdn.omgcloud.top/v1", "User")
[Environment]::SetEnvironmentVariable("OPENAI_API_BASE", "https://cdn.omgcloud.top/v1", "User")
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "您的sk令牌", "User")