#3798·headroom

[BUG] Vertex us multi-region is forwarded to incorrect upstream hostname

Author: tdang2Created Sep 25, 2026Updated Sep 25, 2026
Labelsbug

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:

  1. Install Headroom:
bash
pip install headroom-ai
  1. Authenticate with GCP Application Default Credentials:
bash
gcloud auth application-default login
  1. Configure Claude Code settings.json to use Vertex AI:
json
{
  "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"
  }
}
  1. Verify that Claude Code works directly with Vertex:
bash
claude

The configured Vertex models work normally.

  1. Exit Claude Code and run the same configuration through Headroom:
bash
headroom wrap claude

Headroom 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 token
  1. Start a Claude Code session/send a prompt.

  2. 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
  1. Headroom forwards the request to:
https://us-aiplatform.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict
  1. 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>:streamRawPredict

I 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>:streamRawPredict

Claude 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.com

For example:

https://us-aiplatform.googleapis.com/v1/projects/<project-id>/locations/us/publishers/anthropic/models/claude-opus-5:streamRawPredict

The 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=404

The 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
    ↓
404

For the Vertex us multi-region, the expected mapping is:

locations/us
    ↓
https://aiplatform.us.rep.googleapis.com

Source: headroomlabs-ai/headroom