> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Imagen

> Image generation service implementation using Google's Imagen models

## Overview

`GoogleImageGenService` provides high-quality image generation capabilities using Google's Imagen models. It supports generating multiple images from text prompts with various customization options and advanced prompt understanding for photorealistic and artistic image creation.

<CardGroup cols={2}>
  <Card title="Google Imagen API Reference" icon="code" href="https://reference-server.pipecat.ai/en/latest/api/pipecat.services.google.image.html">
    Pipecat's API methods for Google Imagen integration
  </Card>

  <Card title="Example Implementation" icon="play" href="https://github.com/pipecat-ai/pipecat/blob/main/examples/getting-started/03-still-frame.py">
    Browse examples using Google Imagen
  </Card>

  <Card title="Google Imagen Documentation" icon="book" href="https://cloud.google.com/vertex-ai/generative-ai/docs/image/overview">
    Official Google Imagen API documentation and guides
  </Card>

  <Card title="Google Cloud Console" icon="image" href="https://console.cloud.google.com/">
    Access Imagen models and manage API keys
  </Card>
</CardGroup>

## Installation

To use Google Imagen services, install the required dependencies:

```bash theme={null}
uv add "pipecat-ai[google]"
```

## Prerequisites

### Google Cloud Setup

Before using Google Imagen services, you need:

1. **Google Cloud Account**: Set up at [Google Cloud Console](https://console.cloud.google.com/)
2. **API Key**: Generate a Google API key with Vertex AI access
3. **Project Configuration**: Enable Vertex AI API for your project
4. **Model Access**: Ensure access to Imagen generation models

### Required Environment Variables

* `GOOGLE_API_KEY`: Your Google API key for authentication

## Configuration

<ParamField path="api_key" type="str" required>
  Google AI API key for authentication.
</ParamField>

<ParamField path="params" type="InputParams" default="None" deprecated>
  Configuration parameters for image generation. *Deprecated in v0.0.105. Use
  `settings=GoogleImageGenService.Settings(...)` instead.*
</ParamField>

<ParamField path="http_options" type="Any" default="None">
  HTTP options for the Google AI client.
</ParamField>

<ParamField path="settings" type="GoogleImageGenService.Settings" default="None">
  Runtime-configurable generation settings. See [Settings](#settings) below.
</ParamField>

### Settings

Runtime-configurable settings passed via the `settings` constructor argument using `GoogleImageGenService.Settings(...)`. See [Service Settings](/pipecat/fundamentals/service-settings) for details.

| Parameter          | Type          | Default     | Description                                                                   |
| ------------------ | ------------- | ----------- | ----------------------------------------------------------------------------- |
| `model`            | `str`         | `NOT_GIVEN` | Google Imagen model identifier. *(Inherited from base settings.)*             |
| `number_of_images` | `int`         | `NOT_GIVEN` | Number of images to generate (1-8).                                           |
| `negative_prompt`  | `str \| None` | `NOT_GIVEN` | Optional negative prompt to guide what not to include in the generated image. |

<Note>
  `NOT_GIVEN` values are omitted from the request, letting the service use its
  own defaults (`"imagen-4.0-generate-001"` for model, `1` for
  number\_of\_images). Only parameters that are explicitly set are included.
</Note>

## Usage

### Basic Setup

```python theme={null}
from pipecat.services.google import GoogleImageGenService

image_gen = GoogleImageGenService(
    api_key=os.getenv("GOOGLE_API_KEY"),
)
```

### With Settings

```python theme={null}
image_gen = GoogleImageGenService(
    api_key=os.getenv("GOOGLE_API_KEY"),
    settings=GoogleImageGenService.Settings(
        model="imagen-4.0-generate-001",
        number_of_images=2,
        negative_prompt="blurry, low quality",
    ),
)
```

<Tip>
  The `InputParams` / `params=` pattern is deprecated as of v0.0.105. Use
  `Settings` / `settings=` instead. See the [Service Settings
  guide](/pipecat/fundamentals/service-settings) for migration details.
</Tip>

## Notes

* **No HTTP session needed**: Unlike OpenAI and fal, Google returns image data directly in the API response, so no separate HTTP session is required for downloading.
* **Negative prompts**: Use the `negative_prompt` parameter to specify what should not appear in the generated image, giving you more control over the output.
* **Metrics support**: Google Imagen supports TTFB metrics tracking.
