SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
14 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
940 B · 20 lines typescript
Raw Blame History
1// STATUS: UNVERIFIED — no cloud credentials in this atlas; snippet follows official docs verbatim-ish2// Source: https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai (retrieved 2026-09-18)3// Install: npm install @anthropic-ai/vertex-sdk4// Auth: goes through the standard google-auth-library ADC flow. Env: ANTHROPIC_VERTEX_PROJECT_ID, CLOUD_ML_REGION.5import { AnthropicVertex } from "@anthropic-ai/vertex-sdk";67const client = new AnthropicVertex({8  projectId: process.env.ANTHROPIC_VERTEX_PROJECT_ID,9  region: process.env.CLOUD_ML_REGION ?? "global",10});1112const message = await client.messages.create({13  model: "claude-haiku-4-5@20251001", // cheapest Haiku 4.5 id on Google Cloud14  max_tokens: 8,15  messages: [{ role: "user", content: "Reply with OK." }],16});1718const textBlock = message.content.find((block) => block.type === "text");19if (textBlock && textBlock.type === "text") console.log(textBlock.text);20