Analyzed: March 31, 2026 leak snapshot

Provider selection

Claude Code routes to Vertex when CLAUDE_CODE_USE_VERTEX is truthy. The implementation lives primarily in src/services/api/client.ts, with region helpers in src/utils/envUtils.ts.

Required project identifier

The code expects ANTHROPIC_VERTEX_PROJECT_ID for Vertex use. It is also used as a fallback project identifier when the standard Google-auth discovery paths do not already provide one.

Region behavior

The code comments document a multi-level region strategy:
  1. model-specific VERTEX_REGION_* variables
  2. global CLOUD_ML_REGION
  3. default config region
  4. fallback us-east5
getVertexRegionForModel(model) is the key helper used when creating the Vertex client.

Authentication path

The normal path refreshes GCP credentials through refreshGcpCredentialsIfNeeded() and then constructs a GoogleAuth instance scoped to cloud-platform. The code also exposes a skip-auth path:
  • CLAUDE_CODE_SKIP_VERTEX_AUTH
When skip-auth is enabled, the client uses a mock GoogleAuth object that returns empty request headers.

Metadata-server avoidance

The implementation includes a detailed comment explaining why it supplies ANTHROPIC_VERTEX_PROJECT_ID as a last-resort fallback: to avoid the 12-second metadata-server timeout outside GCP when other discovery methods are absent. That comment is one of the more operationally useful pieces of the source.

Practical deployment notes from source

At minimum, a Vertex deployment needs:
  • CLAUDE_CODE_USE_VERTEX=1
  • valid Google credentials
  • ANTHROPIC_VERTEX_PROJECT_ID
  • a valid region through either VERTEX_REGION_* or CLOUD_ML_REGION