⚠️ Note: This guide is for advanced users or production deployments.For Session 1, use the Gemini API Key Setup instead - it's simpler and faster!
This guide is useful if you want to use Vertex AI or deploy to production with GCP.
This guide walks you through setting up Google Cloud Platform (GCP) and Vertex AI for using Gemini models in a production environment.
- Google account (create one at google.com if needed)
- Credit card for verification (won't be charged for free tier)
- Basic familiarity with cloud consoles
- Go to Google Cloud Console
- Click on the project dropdown at the top
- Click NEW PROJECT
- Enter project name:
wcc-ai-learning(or your preferred name) - Click CREATE
- Wait for the project to be created (this may take a minute)
- In the Cloud Console, go to APIs & Services > Library
- Search for Vertex AI API
- Click on it and press ENABLE
- Wait for the API to be enabled
- Go to APIs & Services > Credentials
- Click + CREATE CREDENTIALS > Service Account
- Fill in the details:
- Service account name:
wcc-ai-learning-sa - Service account ID: (auto-filled)
- Click CREATE AND CONTINUE
- Service account name:
- Grant the following roles:
- Vertex AI User
- Vertex AI Service Agent
- Click CONTINUE
- Click DONE
- In Credentials, find your service account and click on it
- Go to the KEYS tab
- Click ADD KEY > Create new key
- Choose JSON format
- Click CREATE
- The JSON file will download automatically
- Save this file securely - you'll need it for authentication
- Save your JSON key file to a secure location (e.g.,
~/.config/gcp/key.json) - Set the environment variable:
Windows (PowerShell):
$env:GOOGLE_APPLICATION_CREDENTIALS = "C:\path\to\your\key.json"
Windows (Git Bash):
export GOOGLE_APPLICATION_CREDENTIALS="/c/path/to/your/key.json"
macOS/Linux:
export GOOGLE_APPLICATION_CREDENTIALS="$HOME/.config/gcp/key.json"
- Install Google Cloud SDK
- Run:
gcloud auth application-default login
Run this Python script to verify everything is working:
from google.cloud import aiplatform
# Initialize Vertex AI
aiplatform.init(project="YOUR_PROJECT_ID", location="us-central1")
# Test connection
print("✅ GCP setup successful!")
Replace YOUR_PROJECT_ID with your actual project ID (found in the Cloud Console).
- Ensure your service account has the correct roles
- Verify the JSON key file path is correct
- Check that
GOOGLE_APPLICATION_CREDENTIALSenvironment variable is set
- Go to APIs & Services > Library
- Search for Vertex AI API and enable it
- Wait a few minutes for the API to activate
- Verify your project ID is correct
- Check that you're using the right GCP project
- $300 credit for new users (valid for 90 days)
- Always free tier for certain services after credits expire
- Vertex AI: 10 predictions per month free
- Cloud Storage: 5GB free storage
Need Help?
- GCP Documentation
- Vertex AI Documentation
- Ask in the WCC Slack channel!