#!/bin/bash
# Check available Claude models on Vertex AI
PROJECT_ID="amgn-app"
REGION="us-central1"
echo "======================================"
echo "🔍 Checking Available Claude Models"
echo "======================================"
echo ""
echo "📝 Testing different Claude model IDs..."
echo ""
# Common Claude model IDs on Vertex AI
MODELS=(
"claude-3-5-sonnet-20241022"
"claude-3-5-sonnet"
"claude-3-7-sonnet-20250219"
"claude-3-7-sonnet"
"claude-sonnet-4-5"
"claude-3-opus-20240229"
"claude-3-haiku-20240307"
)
for model in "${MODELS[@]}"; do
echo "Testing: $model"
TOKEN=$(gcloud auth print-access-token 2>/dev/null)
if [ -z "$TOKEN" ]; then
echo "⚠️ Not authenticated. Run: gcloud auth login"
break
fi
# Test the endpoint
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
"https://${REGION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${REGION}/publishers/anthropic/models/${model}:rawPredict" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"anthropic_version": "vertex-2023-10-16",
"messages": [{"role": "user", "content": [{"type": "text", "text": "test"}]}],
"max_tokens": 10
}' 2>&1)
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" = "200" ]; then
echo "✅ Model '$model' works! (HTTP $HTTP_CODE)"
echo ""
echo "🎯 CORRECT MODEL ID: $model"
echo ""
echo "Update Vercel environment variable:"
echo " ANTHROPIC_MODEL_ID = $model"
echo ""
break
else
echo "❌ Model '$model' failed (HTTP $HTTP_CODE)"
if [[ "$HTTP_CODE" == "404" ]]; then
echo " → Model not found"
elif [[ "$HTTP_CODE" == "501" ]]; then
echo " → Operation not supported/implemented"
elif [[ "$HTTP_CODE" == "403" ]]; then
echo " → Permission denied"
fi
fi
echo ""
done
echo ""
echo "📝 Common Claude Model IDs on Vertex AI:"
echo " - claude-3-5-sonnet-20241022 (Latest Claude 3.5 Sonnet)"
echo " - claude-3-5-sonnet (Shorthand)"
echo " - claude-3-7-sonnet-20250219 (Claude 3.7 Sonnet)"
echo " - claude-3-7-sonnet (Shorthand)"
echo ""
echo "⚠️ The model ID 'claude-sonnet-4-5' is likely incorrect!"
echo " Update ANTHROPIC_MODEL_ID in Vercel to one of the above."
echo ""