Setup · Claude Code (terminal)
For Day 1 afternoon · runs on macOS, Linux, Windows (WSL)
Prerequisites
- Node.js 20 or later — verify with
node --version - GCP project with the Vertex AI API enabled
- Anthropic model access in Vertex AI Model Garden (allow 1 – 2 business days for approval)
-
gcloudCLI installed and authenticated — verify withgcloud auth list
Install
npm install -g @anthropic-ai/claude-codeAuthenticate
Use Application Default Credentials (the easiest path for the workshop):
gcloud auth application-default loginConfigure for Vertex
Add to your shell profile (~/.zshrc, ~/.bashrc, or equivalent):
export CLAUDE_CODE_USE_VERTEX=1export ANTHROPIC_VERTEX_PROJECT_ID=<your-gcp-project-id>export CLOUD_ML_REGION=asia-northeast1export ANTHROPIC_MODEL=claude-sonnet-4-6@20250514Reload the shell or open a new terminal.
Verify
A one-line round-trip to confirm the install + auth + routing:
claude --print "Reply with the single word: ready"Expected output: ready. If you see that, the install is good.
Build the hello-world agent
mkdir agent-workshop && cd agent-workshopmkdir -p .claude/agents
cat > .claude/agents/file-reader.md <<'EOF'---agent_id: file-readermodel: claude-sonnet-4-6---
# IdentityI am a file-reader. I read files in the working directory and summarise them.
# WorkflowWhen invoked:1. List files in the current directory2. Read the most recent .md or .txt file3. Print a 3-line summary4. ExitEOF
echo "# Hello World" > sample.mdecho "This is my first file." >> sample.md
claude --agent file-readerExpected: the agent lists files, reads sample.md, and prints a 3-line summary.
Troubleshooting
claude: command not found — the npm global bin is not on PATH. Run npm config get prefix and add <that-path>/bin to PATH.
401 Unauthorized from Vertex — re-run gcloud auth application-default login. Confirm ANTHROPIC_VERTEX_PROJECT_ID matches your active GCP project (gcloud config get-value project).
Model not available in region — confirm Anthropic Claude model access is granted in Vertex AI Model Garden for the asia-northeast1 region. Approval can take 1 – 2 business days.
Corporate proxy blocking the API — confirm asia-northeast1-aiplatform.googleapis.com is allowed for outbound HTTPS.