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%
1.5 KB · 30 lines shellscript
Raw Blame History
1#!/usr/bin/env bash2# STATUS: UNVERIFIED — no cloud credentials in this atlas; snippet follows official docs verbatim-ish3# Source: https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai (retrieved 2026-09-18)4# Requires gcloud with Application Default Credentials. No secrets in this file.5set -eo pipefail6PROJECT_ID="${ANTHROPIC_VERTEX_PROJECT_ID:?set ANTHROPIC_VERTEX_PROJECT_ID}"7LOCATION="${CLOUD_ML_REGION:-global}"8MODEL_ID="claude-haiku-4-5@20251001"   # cheapest Haiku 4.5 id on Google Cloud910# Host depends on the endpoint type:11#   global       -> https://aiplatform.googleapis.com                 (locations/global)12#   us | eu      -> https://aiplatform.${LOCATION}.rep.googleapis.com (multi-region, +10%)13#   us-east5 ... -> https://${LOCATION}-aiplatform.googleapis.com     (regional, +10%; Sonnet 4.6 and earlier)14case "$LOCATION" in15  global) HOST="https://aiplatform.googleapis.com" ;;16  us|eu)  HOST="https://aiplatform.${LOCATION}.rep.googleapis.com" ;;17  *)      HOST="https://${LOCATION}-aiplatform.googleapis.com" ;;18esac1920# model is in the URL, anthropic_version is in the body (not a header). Streaming uses :streamRawPredict.21curl -sS "${HOST}/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/anthropic/models/${MODEL_ID}:rawPredict" \22  -H "Authorization: Bearer $(gcloud auth print-access-token)" \23  -H "Content-Type: application/json" \24  -d '{25    "anthropic_version": "vertex-2023-10-16",26    "max_tokens": 8,27    "messages": [{"role": "user", "content": "Reply with OK."}]28  }'29echo30