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

# Google Gemini

> Set up Google Gemini & understand how it's used throughout the app

Google Gemini brings some unique tricks to the table -- native search grounding and strong multimodal reasoning. In the shipped apps, Gemini is especially useful for chat and the default Vision path.

## Get your API key

<Steps>
  <Step title="Sign into Google AI Studio">
    Head to [Google AI Studio](https://aistudio.google.com/) and sign in with your Google account.
  </Step>

  <Step title="Create an API key">
    Navigate to the API keys section and create a new key.
  </Step>

  <Step title="Add it to your env">
    Paste the key in your `.env.local` file:

    ```env theme={null}
    GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key
    ```
  </Step>
</Steps>

<Warning>
  Keep your API key safe and don't share it. You can always regenerate it from Google AI Studio if needed.
</Warning>

## Available models

All models are defined in the unified model registry at `lib/ai/models.ts`.

| Model                 | ID                              | Features                                     |
| --------------------- | ------------------------------- | -------------------------------------------- |
| Gemini 3 Pro          | `gemini-3-pro-preview`          | Vision, Search Grounding                     |
| Gemini 3 Pro Image    | `gemini-3-pro-image-preview`    | Vision, Search Grounding                     |
| Gemini 3.1 Flash Lite | `gemini-3.1-flash-lite-preview` | Vision                                       |
| Gemini 2.5 Flash      | `gemini-2.5-flash`              | Vision, Search Grounding, Thinking/Reasoning |

<Info>
  **Search grounding** is a standout Gemini feature -- it lets the model pull in live web results when answering questions. Your users get up-to-date info without you needing to build a separate search integration.
</Info>

<Tip>
  Gemini 2.5 Flash supports **thinking/reasoning mode**, showing its chain of thought before the final answer. Combine that with search grounding and you've got a seriously capable model.
</Tip>

## Apps using Google Gemini

Google Gemini is integrated through Vercel AI SDK 6.0, with provider routing handled by `lib/ai/ai-utils.ts`.

<CardGroup cols={2}>
  <Card title="Chat" icon="comments" href="/apps/chat">
    Multi-provider chat with search grounding support
  </Card>

  <Card title="Vision" icon="eye" href="/apps/vision">
    Default vision-model path for the meal-analysis app
  </Card>

  <Card title="Marketing Plan" icon="chart-line" href="/apps/marketing-plan">
    Generate structured marketing plans using Gemini models
  </Card>

  <Card title="Launch Simulator" icon="sparkles" href="/apps/launch-simulator">
    Generate Product Hunt launch simulations using Gemini models
  </Card>
</CardGroup>

<Note>
  The shared model registry includes `gemini-3-pro-image-preview`, but the shipped Image Studio currently uses its own OpenAI and Replicate-backed model catalog.
</Note>

## How it works

The codebase uses Vercel AI SDK 6.0 with a unified model registry -- no direct Google API calls needed.

Here's the typical flow for an AI request:

1. You select a model from the unified registry
2. The request goes through `getModelInstance()` in `lib/ai/ai-utils.ts`
3. The provider is determined via `getProviderFromModelId()`
4. The model is instantiated with `customModel()`
5. The response is streamed back to you
6. Results are stored in PostgreSQL

<Card title="Structure" icon="folder" href="/setup/structure">
  Understand the full project structure of the codebase.
</Card>
