Prerequisites
Before you begin, you’ll need:- A Google account
- Basic familiarity with Python and command-line tools
- (Optional) A credit card for Google Cloud billing - new accounts receive a $300 free credit
Setup Steps
Create or Select a Google Cloud Project
Every Google Cloud resource belongs to a project. You’ll need one to use Vertex AI.
- Go to the Google Cloud Console
- Click Create Project or select an existing project
- Give your project a name (e.g., “gemini-quickstart”)
- Note your Project ID - you’ll need this later
When you create a new Google Cloud account, you receive a $300 credit to explore and evaluate Google Cloud services.
Enable Billing
Google Cloud requires billing to be enabled, even if you’re using free credits.
- Follow the billing setup guide
- Link your project to a billing account
Enable Required APIs
Enable the Vertex AI and Cloud Storage APIs for your project:
- Visit the API enablement page
- Select your project
- Click Enable
Install the Vertex AI SDK
Install the Google Gen AI SDK for Python, which provides a unified interface to Gemini models:
For production applications, consider using a virtual environment:
Set Up Authentication
Choose one of the following authentication methods based on your environment:This creates local credentials that the SDK will automatically use.
For Local Development
Install the Google Cloud SDK and authenticate:For Google Colab
If you’re using Google Colab notebooks, authenticate with:For Production
Use a service account with appropriate IAM permissions:- Create a service account
- Grant the Vertex AI User role
- Download the JSON key file
- Set the environment variable:
Development Environments
Google Colab
Google Colab provides free access to GPUs and requires minimal setup:- No installation required - runs in your browser
- Free tier includes CPU and GPU runtimes
- Perfect for learning and prototyping
- Automatically authenticates with your Google account
Vertex AI Workbench
Vertex AI Workbench is Google Cloud’s managed notebook environment:- Pre-configured with ML libraries
- No additional authentication needed
- Integrated with Google Cloud services
- Supports both JupyterLab and managed notebooks
- Go to Vertex AI Workbench
- Click Create New → User-Managed Notebook
- Choose Python 3 environment
- Click Create
Local Development
For local development on your machine:- Install Python 3.8 or higher
- Install the Google Cloud SDK
- Use your preferred IDE (VS Code, PyCharm, etc.)
- Follow the authentication steps above
Verify Your Setup
Test that everything is working with this simple script:Troubleshooting
Authentication errors
Authentication errors
Error:
DefaultCredentialsError or Could not automatically determine credentialsSolution: Run gcloud auth application-default login or set GOOGLE_APPLICATION_CREDENTIALS environment variable.API not enabled
API not enabled
Error:
Vertex AI API has not been used in project...Solution: Enable the Vertex AI API at https://console.cloud.google.com/apis/library/aiplatform.googleapis.comPermission denied
Permission denied
Error:
Permission denied or 403 ForbiddenSolution: Ensure your account has the Vertex AI User role. Add it in IAM Settings.Quota exceeded
Quota exceeded
Error:
Quota exceeded or 429 Too Many RequestsSolution: Check your quota limits and request increases if needed. Consider using exponential backoff in your code.Next Steps
Quickstart Tutorial
Build your first Gemini application in minutes
Gemini Models
Explore the full Gemini model family
Multimodal Capabilities
Learn to process text, images, audio, and video
Function Calling
Connect Gemini to external tools and APIs