by OrionStarAI
Proxy service for Claude Code to access Claude models via GCP Vertex AI | Let Claude Code access Claude models via GCP Vertex AI
# Add to your Claude Code skills
git clone https://github.com/OrionStarAI/claudecode-vertex-proxy一个用于将 Claude API 请求转换为 Google Cloud Vertex AI 格式的代理服务,使 Claude Code 客户端能够通过 GCP Vertex AI 访问 Claude 模型。
本项目是为 Google Cloud Vertex AI 企业客户提供的协议转换工具,旨在简化 Claude Code 客户端与 GCP Vertex AI 的集成流程。
本项目:
使用前提:
合规要求:
本程序支持以下环境变量:
| 环境变量 | 说明 | 默认值 | |----------|------|--------| | | GCP 服务账户 JSON 凭据文件路径 | | | | GCP Vertex AI 区域(如 、、 等) | | | | 是否验证 SSL 证书(设为 可用于 Charles/Fiddler 抓包调试) | |
GCP_KEY_FILEkey/key.jsonGCP_REGIONglobalus-east5europe-west1globalSSL_VERIFYfalsetrue将 GCP 服务账户 JSON 凭据文件放置于 key/key.json(默认路径)。
如需自定义,可通过环境变量指定:
# Windows
set GCP_KEY_FILE=path/to/your-credentials.json
# Linux/Mac
export GCP_KEY_FILE=path/to/your-credentials.json
默认使用 global 区域。如需指定其他区域:
# Windows
set GCP_REGION=us-east5
# Linux/Mac
export GCP_REGION=us-east5
卸载旧版本(如有):
npm uninstall -g claude-code
npm uninstall -g @anthropic-ai/claude
安装官方版本:
npm install -g @anthropic-ai/claude-code
使用启动脚本(推荐,自动创建虚拟环境并安装依赖):
# Linux/Mac
bash start_proxy.sh
# Windows
start_proxy.cmd
启动脚本会自动:
.venv)服务将在 http://0.0.0.0:8000 启动。
在新的终端窗口中设置以下环境变量:
# API Key 可填写任意值(本代理不使用此值进行认证)
export ANTHROPIC_API_KEY='placeholder'
# 指向代理服务地址
export ANTHROPIC_BASE_URL=http://127.0.0.1:8000
可使用 zcf (Zero-Config Flow for Claude Code) 进行持久化配置:
npx zcf
按界面提示完成配置即可。
配置完成后,即可正常使用 Claude Code,所有请求将通过代理服务转发至 GCP Vertex AI。