Skip to main content
Vertex AI is Google Cloud’s enterprise AI platform, offering advanced features, broader model access, and deep integration with Google Cloud services. Use Vertex AI for production applications that require governance, IAM control, and access to Model Garden.
Vertex AI is part of the unified @genkit-ai/google-genai package. For simpler setup, see Google AI.

Installation

Setup

Vertex AI supports two authentication methods: This is the standard authentication method for production applications. Prerequisites:
  • Google Cloud project with billing enabled
  • Vertex AI API enabled
  • Appropriate IAM permissions
Local Development:
Production (GCP): Use a service account with the required permissions:
  • roles/aiplatform.user
  • roles/storage.objectViewer (for some features)
Configure the Plugin:

Method 2: Express Mode (API Key)

Vertex AI Express Mode provides a simplified way to try Vertex AI features using just an API key, without requiring full GCP project setup or billing. Get an API Key:
  1. Visit Vertex AI Studio
  2. Enable Express Mode
  3. Generate an API key
Configure the Plugin:
With Express Mode, you don’t provide projectId or location in the config.

Available Models

Text Generation (Gemini)

All Gemini models available through Google AI are also available on Vertex AI:
  • gemini-2.5-flash - Balanced performance and speed
  • gemini-2.5-pro - Most powerful Gemini model
  • gemini-2.5-flash-lite - Fastest option

Image Generation (Imagen)

  • imagen-3.0-generate-002 - High-quality image generation
  • imagen-3.0-fast-generate-001 - Faster generation

Music Generation (Lyria)

Vertex AI exclusive:
  • lyria-002 - Generate music and audio from text descriptions

Video Generation (Veo)

  • veo-002 - Generate videos from text prompts

Embeddings

  • text-embedding-005 - Latest embedding model
  • text-embedding-004 - Previous generation
  • text-multilingual-embedding-002 - Multilingual support

Usage Examples

Basic Text Generation

Music Generation with Lyria

Image Generation with Imagen

Multimodal Input

Context Caching

Reduce costs and latency for repeated prompts with large context:
Ground model responses with real-time search results:

Function Calling

Embeddings

Model Garden Access

Vertex AI Model Garden provides access to models from various providers:

Anthropic Claude via Model Garden

Meta Llama Models

Vector Search Integration

Vertex AI Vector Search enables high-performance similarity search for RAG applications.

Setup Vector Search Index

Retrieval-Augmented Generation (RAG)

Configuration Options

Regional Endpoints

Choose the region closest to your users:

Global Endpoint

Some features like Lyria are only available in specific regions.

Model Configuration

Advanced Features

Model Tuning

Vertex AI supports fine-tuning Gemini models on your data:
Then use your tuned model:

Model Evaluation

Use Vertex AI’s evaluation tools to assess model performance:

Request Logging

Vertex AI automatically logs requests for monitoring and debugging:

Vertex AI vs Google AI

Best Practices

  1. Use regional endpoints close to your users for lower latency
  2. Enable context caching for prompts with repeated large context
  3. Implement proper IAM controls with service accounts
  4. Monitor usage with Cloud Monitoring
  5. Use Vector Search for RAG applications instead of manual similarity
  6. Enable request logging for debugging and auditing
  7. Set up alerts for quota limits and errors
  8. Use Model Garden to access diverse models without managing multiple APIs

Troubleshooting

Authentication Errors

Solution:
Or set GOOGLE_APPLICATION_CREDENTIALS to your service account key:

API Not Enabled

Solution:

Permission Denied

Solution: Ensure your account or service account has the required IAM roles:

Region Not Supported

Some models are only available in specific regions. Check the Vertex AI documentation for model availability.

Pricing

Vertex AI pricing varies by:
  • Model type (Flash vs Pro)
  • Input/output token count
  • Additional features (context caching, grounding)
  • Region
See the Vertex AI Pricing page for details. Cost Optimization Tips:
  • Use gemini-2.5-flash for most tasks
  • Enable context caching for repeated prompts
  • Use batch predictions for high-volume processing
  • Set appropriate maxOutputTokens limits

Next Steps