Harnessing the power of Google’s state-of-the-art generative AI models, Imagen 4 for image creation and Google Veo for video production, is now more accessible than ever through the Vertex AI platform. By leveraging the Vertex AI API and employing strategic cost-management techniques, you can generate high-quality visual content affordably. This guide provides a comprehensive overview of pricing, free-tier options, and cost-optimization strategies to help you get started.
Understanding the Pricing Structure
The cost of using Imagen 4 and Google Veo on Vertex AI is based on a pay-as-you-go model. You are billed for the amount of processing power used to generate your images and videos.
Imagen Pricing (table from Google Cloud pricing on accessed data. For up-to-date pricing, see here):
Model | Feature | Description | Input | Output | Price |
---|---|---|---|---|---|
Imagen 4 Ultra | Image generation | Generate an image | Text prompt | Image | $0.06 per image |
Imagen 4 | Image generation | Generate an image | Text prompt | Image | $0.04 per image |
Imagen 4 Fast | Image generation | Generate an image | Text prompt | Image | $0.02 per image |
Imagen 3 | Image generation | Generate an image Edit an image Customize an image | Text prompt | Image | $0.04 per image |
Imagen 3 Fast | Image generation | Generate an image | Text prompt | Image | $0.02 per image |
Imagen 2, Imagen | Image generation | Generate an image | Text prompt | Image | $0.020 per image |
Image editing | Edit an image using mask free or mask approach | Image/Text prompt | Image | $0.020 per image | |
Upscaling | Increase resolution of a generated image to 2k and 4k | Image | Image | $0.003 per image | |
Fine-tuning | Enable a “subject” provided by the user to used in Imagen prompts (few shot training) | Subject(s) with text identifier and 4-8 images per subject | Fine-tuned model (after training with user provided subjects) | $ per node hour (Vertex AI custom training pricing) | |
Visual Captioning | Generate a short or long text caption for an image | Image | Text caption | $0.0015/image | |
Visual Q&A | Provide an answer based on a question referencing an image | Image/Text prompt | Text answer | $0.0015/image |
Google Veo pricing: The following table is from Google Cloud at accessed data. For updated pricing, see here.
Model | Feature | Description | Input | Output | Price |
---|---|---|---|---|---|
Veo 3 | Video generation | Generate videos from a text prompt or reference image | Text/Image prompt | Video | $0.50/second |
Veo 3 | Video + Audio generation | Generate video with synchronized speech/sound effects from a text prompt or reference image | Text/Image prompt | Video + Audio | $0.75/second |
Veo 2 | Video generation | Generate videos from a text prompt or reference image | Text/Image prompt | Video | $0.50/second |
Veo 2 | Advanced Controls | Generate videos through start and end frame interpolation, extend generated videos, and apply camera controls | Text/Image/Video prompt | Video | $0.50/second |
It’s important to consult the official Google Cloud Vertex AI pricing page for the most current and detailed information, as these rates are subject to change.
Take Advantage of the Free Tier and Credits
For new users, Google Cloud offers a generous free tier that can significantly reduce your initial costs.
- $300 in Free Credits: New Google Cloud customers are eligible for $300 in free credits that can be used over 90 days. These credits can be applied to Vertex AI services, including Imagen and Veo, allowing for substantial experimentation and initial project development without any out-of-pocket expense.
- Free Usage: Some Vertex AI services may also have a free usage tier, which allows for a certain amount of free processing per month. Be sure to check the specifics for the models you intend to use.
But what’s Vertex AI?
The Vertex AI API is a unified interface for Google Cloud’s comprehensive machine learning platform, allowing developers and data scientists to programmatically access every step of the ML lifecycle. It provides the tools to build, train, and deploy custom machine learning models, as well as leverage powerful pre-trained models like Gemini for multimodal tasks, Imagen for image generation, and Codey for code assistance. By interacting with this single API, users can manage datasets, run training jobs, evaluate model performance, and deploy models to scalable endpoints for real-time predictions, effectively streamlining the entire process from experimentation to production.
Strategies for Cost Optimization
Beyond the free tier, several strategies can help you manage and minimize your expenses when using Vertex AI for media generation.
- Choose the Right Model: Vertex AI often provides different versions of its models. For less complex tasks, using a standard or “fast” version of a model can be more cost-effective than a more powerful, and consequently more expensive, version.
- Optimize Prompts: Well-crafted, detailed prompts can lead to better results in the first attempt, reducing the need for multiple generations and the associated costs. Experiment with prompt engineering to achieve your desired output efficiently.
- Control Generation Parameters: Adjusting parameters such as image resolution or video length can directly impact the cost. For drafts or internal reviews, consider generating lower-resolution images or shorter video clips to save on processing fees.
- Leverage Caching: For identical prompts, Vertex AI may offer cached results, which can reduce the cost of repeated requests.
- Monitor Usage and Set Budgets: Regularly monitor your Vertex AI usage through the Google Cloud Console. You can set up budget alerts to notify you when your spending reaches certain thresholds, helping you avoid unexpected costs.
- Use Spot Instances (for advanced workflows): For large-scale, non-critical batch processing, consider using spot instances for your underlying compute resources. These instances are offered at a significant discount compared to on-demand pricing, though they can be preempted.
Getting Started with the Vertex AI API
To begin generating images and videos programmatically, you’ll need to use the Vertex AI API. Here’s a simplified overview of the steps involved:
- Set up your Google Cloud Project: Create a new project in the Google Cloud Console and enable the Vertex AI API on Google Cloud Console.
- For an interactive interface, you can use Google Cloud’s Vertex AI Studio. This doesn’t require coding. However, the coding API is very convenient when the number of images and videos to be generated is on a large scale.
- Authentication: Set up authentication for your environment. This typically involves creating a service account and using its credentials to authenticate your API requests.
Important: It is crucial to disable or delete active Vertex AI resources after you have finished using them, primarily for cost management and security. Leaving resources such as a deployed model on an active endpoint is akin to leaving a high-performance computer running continuously—it incurs charges even when idle, as it reserves resources to be ready to serve predictions. Similarly, running notebook instances or other jobs will continue to accumulate costs. By proactively shutting down endpoints, deleting unused models and datasets, and disabling the API on projects that are no longer active, you prevent unnecessary expenditure and reduce your project’s potential security footprint, ensuring you only pay for the computational resources you actively consume. The API can be disabled here. Also, you need to disable Cloud Storage to avoid storage charge. You can do that here.
For use with the coding interface:
- Install the Client Libraries: Google provides client libraries for various programming languages, such as Python, to simplify interaction with the Vertex AI API.
- Make API Calls: Use the client libraries to make API calls to the Imagen and Veo models, providing your prompts and desired parameters.
Here are some conceptual code snippets to illustrate the process:
Python example for Imagen 4 image generation:
Python
from google.cloud import aiplatform
from google.protobuf import struct_pb2
# Initialize the Vertex AI client
aiplatform.init(project='your-gcp-project-id', location='us-central1')
# Define the model and prompt
model = aiplatform.Model('projects/your-gcp-project-id/locations/us-central1/models/imagen@005')
prompt = "A futuristic cityscape at sunset, with flying cars and neon lights"
# Generate the image
response = model.predict(instances=[struct_pb2.Value(string_value=prompt)])
# Process the response to get the image data
Conceptual Python example for Google Veo video generation:
Python
from google.cloud import aiplatform
# Initialize the Vertex AI client
aiplatform.init(project='your-gcp-project-id', location='us-central1')
# Define the model and prompt
model = aiplatform.Model('projects/your-gcp-project-id/locations/us-central1/models/veo@latest')
prompt = "A short, cinematic clip of a majestic eagle soaring over a mountain range"
# Generate the video
response = model.predict(instances=[{'prompt': prompt}])
# Process the response to get the video data
Discover more from Science Comics
Subscribe to get the latest posts sent to your email.