# <img src="https://models.dev/logos/google.svg" alt="Google logo" className="inline w-8 h-8 mr-2 align-middle dark:invert dark:brightness-0 dark:contrast-200" />Google
[EN] Source: https://mastra.ai/models/providers/google

Access 24 Google models through Mastra's model router. Authentication is handled automatically using the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.

Learn more in the [Google documentation](https://ai.google.dev/gemini-api/docs/pricing).

```bash
GOOGLE_GENERATIVE_AI_API_KEY=your-api-key
```

```typescript
import { Agent } from "@mastra/core";

const agent = new Agent({
  name: "my-agent",
  instructions: "You are a helpful assistant",
  model: "google/gemini-1.5-flash"
});

// Generate a response
const response = await agent.generate("Hello!");

// Stream a response
const stream = await agent.stream("Tell me a story");
for await (const chunk of stream) {
  console.log(chunk);
}
```

## Models

<ProviderModelsTable
  models={[
  {
    "model": "google/gemini-1.5-flash",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1000000,
    "maxOutput": 8192,
    "inputCost": 0.075,
    "outputCost": 0.3
  },
  {
    "model": "google/gemini-1.5-flash-8b",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1000000,
    "maxOutput": 8192,
    "inputCost": 0.0375,
    "outputCost": 0.15
  },
  {
    "model": "google/gemini-1.5-pro",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1000000,
    "maxOutput": 8192,
    "inputCost": 1.25,
    "outputCost": 5
  },
  {
    "model": "google/gemini-2.0-flash",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1048576,
    "maxOutput": 8192,
    "inputCost": 0.1,
    "outputCost": 0.4
  },
  {
    "model": "google/gemini-2.0-flash-lite",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1048576,
    "maxOutput": 8192,
    "inputCost": 0.075,
    "outputCost": 0.3
  },
  {
    "model": "google/gemini-2.5-flash",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.3,
    "outputCost": 2.5
  },
  {
    "model": "google/gemini-2.5-flash-image",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 32768,
    "inputCost": 0.3,
    "outputCost": 30
  },
  {
    "model": "google/gemini-2.5-flash-image-preview",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 32768,
    "inputCost": 0.3,
    "outputCost": 30
  },
  {
    "model": "google/gemini-2.5-flash-lite",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.1,
    "outputCost": 0.4
  },
  {
    "model": "google/gemini-2.5-flash-lite-preview-06-17",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.1,
    "outputCost": 0.4
  },
  {
    "model": "google/gemini-2.5-flash-lite-preview-09-2025",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.1,
    "outputCost": 0.4
  },
  {
    "model": "google/gemini-2.5-flash-preview-04-17",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.15,
    "outputCost": 0.6
  },
  {
    "model": "google/gemini-2.5-flash-preview-05-20",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.15,
    "outputCost": 0.6
  },
  {
    "model": "google/gemini-2.5-flash-preview-09-2025",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.3,
    "outputCost": 2.5
  },
  {
    "model": "google/gemini-2.5-flash-preview-tts",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 8000,
    "maxOutput": 16000,
    "inputCost": 0.5,
    "outputCost": 10
  },
  {
    "model": "google/gemini-2.5-pro",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 1.25,
    "outputCost": 10
  },
  {
    "model": "google/gemini-2.5-pro-preview-05-06",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 1.25,
    "outputCost": 10
  },
  {
    "model": "google/gemini-2.5-pro-preview-06-05",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 1.25,
    "outputCost": 10
  },
  {
    "model": "google/gemini-2.5-pro-preview-tts",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 8000,
    "maxOutput": 16000,
    "inputCost": 1,
    "outputCost": 20
  },
  {
    "model": "google/gemini-embedding-001",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 2048,
    "maxOutput": 3072,
    "inputCost": 0.15,
    "outputCost": null
  },
  {
    "model": "google/gemini-flash-latest",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.3,
    "outputCost": 2.5
  },
  {
    "model": "google/gemini-flash-lite-latest",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 0.1,
    "outputCost": 0.4
  },
  {
    "model": "google/gemini-live-2.5-flash",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 8000,
    "inputCost": 0.5,
    "outputCost": 2
  },
  {
    "model": "google/gemini-live-2.5-flash-preview-native-audio",
    "imageInput": false,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 65536,
    "inputCost": 0.5,
    "outputCost": 2
  }
]}
/>

## Advanced Configuration

### Custom Headers

```typescript
const agent = new Agent({
  name: "custom-agent",
  model: {
    id: "google/gemini-1.5-flash",
    apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY,
    headers: {
      "X-Custom-Header": "value"
    }
  }
});
```

### Dynamic Model Selection

```typescript
const agent = new Agent({
  name: "dynamic-agent",
  model: ({ runtimeContext }) => {
    const useAdvanced = runtimeContext.task === "complex";
    return useAdvanced
      ? "google/gemini-live-2.5-flash-preview-native-audio"
      : "google/gemini-1.5-flash";
  }
});
```

## Provider Options

Google supports the following provider-specific options via the `providerOptions` parameter:

```typescript
const response = await agent.generate("Hello!", {
  providerOptions: {
    google: {
      // See available options in the table below
    }
  }
});
```

### Available Options

<PropertiesTable
  content={[
    {
        "name": "responseModalities",
        "type": "(\"TEXT\" | \"IMAGE\")[] | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "thinkingConfig",
        "type": "{ thinkingBudget?: number | undefined; includeThoughts?: boolean | undefined; } | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "cachedContent",
        "type": "string | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "structuredOutputs",
        "type": "boolean | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "safetySettings",
        "type": "{ category: \"HARM_CATEGORY_UNSPECIFIED\" | \"HARM_CATEGORY_HATE_SPEECH\" | \"HARM_CATEGORY_DANGEROUS_CONTENT\" | \"HARM_CATEGORY_HARASSMENT\" | \"HARM_CATEGORY_SEXUALLY_EXPLICIT\" | \"HARM_CATEGORY_CIVIC_INTEGRITY\"; threshold: \"HARM_BLOCK_THRESHOLD_UNSPECIFIED\" | ... 4 more ... | \"OFF\"; }[] | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "threshold",
        "type": "\"HARM_BLOCK_THRESHOLD_UNSPECIFIED\" | \"BLOCK_LOW_AND_ABOVE\" | \"BLOCK_MEDIUM_AND_ABOVE\" | \"BLOCK_ONLY_HIGH\" | \"BLOCK_NONE\" | \"OFF\" | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "audioTimestamp",
        "type": "boolean | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "labels",
        "type": "Record<string, string> | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "mediaResolution",
        "type": "\"MEDIA_RESOLUTION_UNSPECIFIED\" | \"MEDIA_RESOLUTION_LOW\" | \"MEDIA_RESOLUTION_MEDIUM\" | \"MEDIA_RESOLUTION_HIGH\" | undefined",
        "description": "",
        "isOptional": true
    },
    {
        "name": "imageConfig",
        "type": "{ aspectRatio?: \"1:1\" | \"2:3\" | \"3:2\" | \"3:4\" | \"4:3\" | \"4:5\" | \"5:4\" | \"9:16\" | \"16:9\" | \"21:9\" | undefined; } | undefined",
        "description": "",
        "isOptional": true
    }
]}
/>



## Direct Provider Installation

This provider can also be installed directly as a standalone package, which can be used instead of the Mastra model router string. View the [package documentation](https://www.npmjs.com/package/@ai-sdk/google) for more details.

```bash npm2yarn copy
npm install @ai-sdk/google
```

For detailed provider-specific documentation, see the [AI SDK Google provider docs](https://ai-sdk.dev/providers/ai-sdk-providers/google).


---
title: "Groq | Models | Mastra"
description: "Use Groq models with Mastra. 17 models available."
---

{/* This file is auto-generated by generate-model-docs.ts - DO NOT EDIT MANUALLY */}



import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";