[BUG] Vertex us multi-region is forwarded to incorrect upstream hostname
Description
When using Claude Code with Vertex AI through headroom wrap claude, Headroom incorrectly constructs the upstream Google Vertex endpoint for requests using the us multi-region.
Claude Code works correctly when connecting directly to Vertex AI. When the same Claude Code configuration is run through Headroom, requests to /locations/us/... are forwarded to:
https://us-aiplatform.googleapis.com/...and return HTTP 404.
For the Vertex AI us multi-region, the expected endpoint is:
https://aiplatform.us.rep.googleapis.com/...The issue appears to be in Headroom's mapping of the Vertex us multi-region location to its upstream hostname.
To Reproduce
Steps to reproduce the behavior:
- Install Headroom:
pip install headroom-ai- Authenticate with GCP Application Default Credentials:
gcloud auth application-default login- Configure Claude Code
settings.jsonto use Vertex AI:
{
"gcpAuthRefresh": "gcloud auth application-default login",
"env": {
"CLAUDE_CODE_USE_VERTEX": "1",
"CLOUD_ML_REGION": "us",
"ANTHROPIC_VERTEX_PROJECT_ID": "<project-id>",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5"
}
}- Verify that Claude Code works directly with Vertex:
claudeThe configured Vertex models work normally.
- Exit Claude Code and run the same configuration through Headroom:
headroom wrap claudeHeadroom correctly detects Vertex mode:
Vertex mode: ANTHROPIC_VERTEX_BASE_URL=http://127.0.0.1:8787
→ compress, then forward to Vertex with your GCP ADC tokenStart a Claude Code session/send a prompt.
Claude Code sends Headroom a Vertex request using
/locations/us/..., for example:
POST /projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict- Headroom forwards the request to:
https://us-aiplatform.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict- The upstream request returns HTTP 404.
Expected Behavior
Headroom should correctly proxy the Vertex AI us multi-region request.
When it receives:
/projects/<project-id>/locations/us/publishers/anthropic/models/<model>:streamRawPredictI expect it to forward the request using the Vertex us multi-region endpoint:
https://aiplatform.us.rep.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/<model>:streamRawPredictClaude Code should then work through Headroom the same way it works when connecting directly to Vertex AI.
Actual Behavior
Headroom receives the correct /locations/us/... request but derives the upstream hostname as:
https://us-aiplatform.googleapis.comFor example:
https://us-aiplatform.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredictThe upstream request returns HTTP 404.
This occurs for both rawPredict and streamRawPredict.
Headroom itself remains healthy: /health and /readyz return HTTP 200.
Code Sample
No code is required to reproduce this issue. It occurs using Headroom's documented Claude Code wrapper
Error Output
Relevant Headroom log:
event=proxy_inbound_request
method=POST
path=/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict
event=outbound_request
forwarder=streaming
method=POST
path=https://us-aiplatform.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict
Forwarding upstream streaming error status=404
url=https://us-aiplatform.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict
event=proxy_inbound_response
method=POST
path=/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict
status=404The non-streaming rawPredict request also returns 404.
The upstream response is a generic Google HTML 404 (Not Found) response rather than a Vertex JSON model/authentication error.
Environment
- Headroom version:
<run: python -c "import headroom; print(headroom.__version__)"> - Python version:
<run: python --version> - OS: macOS (Apple Silicon / arm64)
- LLM Provider: Anthropic Claude via Google Vertex AI
- Claude Code version:
2.1.282 - Vertex project:
<project-id> - Vertex request location:
us - Models observed:
claude-opus-5
Additional Context
Claude Code works correctly against Vertex AI without Headroom using the same project, authentication, and model configuration.
Headroom successfully receives the Vertex-shaped request from Claude Code. The failure occurs when Headroom constructs the upstream Google endpoint.
The apparent mapping is currently:
locations/us
↓
https://us-aiplatform.googleapis.com
↓
404For the Vertex us multi-region, the expected mapping is:
locations/us
↓
https://aiplatform.us.rep.googleapis.comSource: headroomlabs-ai/headroom