Overview
GoogleImageGenService provides high-quality image generation capabilities using Google’s Gemini image models. It supports generating multiple images from text prompts with various customization options and advanced prompt understanding for photorealistic and artistic image creation.
Google Image Generation API Reference
Pipecat’s API methods for Google image generation
Example Implementation
Browse examples using Google image generation
Gemini Image Generation Documentation
Official Google Gemini image generation documentation
Google Cloud Console
Access Gemini models and manage API keys
Installation
To use Google image generation services, install the required dependencies:Prerequisites
Google Cloud Setup
Before using Google image generation services, you need:- Google Cloud Account: Set up at Google Cloud Console
- API Key: Generate a Google API key with Gemini API access
- Project Configuration: Enable Gemini API for your project
- Model Access: Ensure access to Gemini image models
Required Environment Variables
GOOGLE_API_KEY: Your Google API key for authentication
Configuration
str
required
Google AI API key for authentication.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use
settings=GoogleImageGenService.Settings(...) instead.Any
default:"None"
HTTP options for the Google AI client.
GoogleImageGenService.Settings
default:"None"
Runtime-configurable generation settings. See Settings below.
Settings
Runtime-configurable settings passed via thesettings constructor argument using GoogleImageGenService.Settings(...). See Service Settings for details.
Usage
Basic Setup
With Settings
Notes
- RGB output: Generated images are converted to RGB format for compatibility with output transports that render RGB video by default.
- Sequential generation: When
number_of_imagesis greater than 1, each image is generated in a separate request, processed one after another. - No HTTP session needed: Google returns image data directly in the API response, so no separate HTTP session is required for downloading.
- Metrics support: Google image generation supports TTFB metrics tracking.