English | 中文
A proxy service that converts Claude API requests to Google Cloud Vertex AI format, enabling Claude Code clients to access Claude models through GCP Vertex AI.
This project is a protocol conversion tool designed for Google Cloud Vertex AI enterprise customers to simplify the integration between Claude Code client and GCP Vertex AI.
This project:
- ✅ Is a legitimate API protocol conversion tool
- ✅ Is intended for users with existing GCP Vertex AI Claude model access
- ✅ Complies with Google Cloud and Anthropic terms of service
- ❌ Does not provide any functionality to bypass authorization or network restrictions
- ❌ Does not provide free access to paid services
Prerequisites:
- You must have a valid Google Cloud account
- You must have enabled Vertex AI API in your GCP project
- You must have access to Claude models (via Vertex AI Model Garden)
Compliance Requirements:
- Users must comply with Google Cloud Platform Terms of Service
- Users must comply with Anthropic Usage Policy
- Users must comply with applicable local laws and regulations
This program supports the following environment variables:
| Variable | Description | Default |
|---|---|---|
GCP_KEY_FILE |
Path to GCP service account JSON credentials file | key/key.json |
GCP_REGION |
GCP Vertex AI region (e.g., global, us-east5, europe-west1) |
global |
SSL_VERIFY |
Whether to verify SSL certificates (set to false for Charles/Fiddler debugging) |
true |
Place your GCP service account JSON credentials file at key/key.json (default path).
To customize, set the environment variable:
# Windows
set GCP_KEY_FILE=path/to/your-credentials.json
# Linux/Mac
export GCP_KEY_FILE=path/to/your-credentials.jsonDefault region is global. To specify a different region:
# Windows
set GCP_REGION=us-east5
# Linux/Mac
export GCP_REGION=us-east5-
Uninstall old versions (if any):
npm uninstall -g claude-code npm uninstall -g @anthropic-ai/claude
-
Install official version:
npm install -g @anthropic-ai/claude-code
Use the startup script (recommended, automatically creates virtual environment and installs dependencies):
# Linux/Mac
bash start_proxy.sh
# Windows
start_proxy.cmdThe startup script will automatically:
- Create a Python virtual environment (
.venv) - Install required dependencies
- Start the proxy service
The service will start at http://0.0.0.0:8000.
Set the following environment variables in a new terminal:
# API Key can be any value (not used for authentication by this proxy)
export ANTHROPIC_API_KEY='placeholder'
# Point to the proxy service
export ANTHROPIC_BASE_URL=http://127.0.0.1:8000Use zcf (Zero-Config Flow for Claude Code) for persistent configuration:
npx zcfFollow the on-screen prompts to complete the configuration.
Once configured, you can use Claude Code normally. All requests will be forwarded to GCP Vertex AI through the proxy service.
# Health check
curl http://127.0.0.1:8000/health
# List available models
curl http://127.0.0.1:8000/v1/modelsPlease check:
- Credentials file exists at
key/key.json(or path specified byGCP_KEY_FILE) - Python dependencies are correctly installed
- Port 8000 is not in use
Please check:
- Network connection stability
- Firewall not blocking outbound connections
- GCP service status
Please verify:
- Service account has Vertex AI access permissions
- Vertex AI API is enabled in GCP project
- Credentials file permissions are correct
| Endpoint | Description |
|---|---|
/v1/messages |
Claude messages API (streaming/non-streaming) |
/v1/models |
Available models list |
/health |
Health check |
api_requests.log- Detailed request/response logsapi_requests_simple.log- Simplified conversation logs
- Automatically removes
input_examplesfield not supported by Vertex AI - Supports Claude Code model name mapping
- Automatically adds required fields like
anthropic_version
- Credentials files (
key/*.json) are excluded in.gitignore, do not commit manually - Run this service only in trusted network environments
- Rotate service account keys regularly
This project is licensed under the Apache License 2.0.
