← ClaudeAtlas

anthropic-vertex-integrationlisted

Claude on Vertex AI via the AnthropicVertex SDK — lazy ADC client init, env-based project/region resolution, async helpers, backoff retry. Use when calling Claude via GCP Vertex AI (not direct Anthropic API).
ajyadav013/claude-kit · ★ 12 · AI & Automation · score 72
Install: claude install-skill ajyadav013/claude-kit
Integrate Claude on Vertex AI using the AnthropicVertex SDK with lazy authentication, resilient helpers, and optional tracing. ## When to use - Calling Claude via Google Cloud Vertex AI (not the direct Anthropic API with API keys) - Building async helpers for one-shot completions, JSON extraction, or tool-use calls - Implementing exponential-backoff retry for transient Vertex AI errors - Composing system prompts from personas or task instructions - Adding Langfuse observability to Claude completions (latency, input/output, errors) - Migrating from direct Anthropic SDK (API-key auth) to Vertex AI (ADC auth) - Setting up lazy client initialization with env-var-based project/region resolution - Creating a reusable LazyClient pattern for SDK singletons with test reset hooks ## Core conventions 1. **AnthropicVertex SDK installation**: install with `pip install 'anthropic[vertex]'` (the `[vertex]` extra is required). The SDK uses Google Cloud Application Default Credentials (ADC) — run `gcloud auth application-default login` locally or rely on service-account credentials in production (GOOGLE_APPLICATION_CREDENTIALS env var). 2. **Project-ID resolution fallback chain**: `_resolve_project_id(project_id)` checks `project_id` parameter → `VERTEX_PROJECT_ID` → `BQ_PROJECT_ID` → `GOOGLE_CLOUD_PROJECT` → `GCLOUD_PROJECT` env vars in order, raising `ValueError` if all are empty. This lets BigQuery-focused services reuse `BQ_PROJECT_ID` for Vertex calls without duplicating config. 3.