Provider selection
Claude Code routes to Vertex whenCLAUDE_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 expectsANTHROPIC_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:- model-specific
VERTEX_REGION_*variables - global
CLOUD_ML_REGION - default config region
- fallback
us-east5
getVertexRegionForModel(model) is the key helper used when creating the Vertex client.
Authentication path
The normal path refreshes GCP credentials throughrefreshGcpCredentialsIfNeeded() and then constructs a GoogleAuth instance scoped to cloud-platform.
The code also exposes a skip-auth path:
CLAUDE_CODE_SKIP_VERTEX_AUTH
GoogleAuth object that returns empty request headers.
Metadata-server avoidance
The implementation includes a detailed comment explaining why it suppliesANTHROPIC_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_*orCLOUD_ML_REGION