Claude Code
Claude Code 接入第三方 API
Claude Code 原生使用 Anthropic Messages API。clovapi 在 switch 时会自动把 profile 映射为 Claude Code 需要的 anthropic 形态,无需手动改环境变量或对照协议表。
1.安装 clovapi
通过 npm、Homebrew 或 winget 安装 CLI,或使用桌面客户端。
npm i -g @clovapi/cli2.保存第三方 API profile
运行 add 并按提示填写上游 Base URL、API Key 与模型 ID。持久化前会自动探测连通性。
clovapi add --name my-api3.切换到 Claude Code
将 profile 下发到 Claude Code 配置。之后启动 claude 即走该上游。
clovapi switch --cli claude-code my-api