Skip to main content

Google Generative AI Provider

The Google Generative AI provider enables you to use Google’s Gemini models for text generation, vision, code execution, and more.

Installation

Setup

Get your API key from Google AI Studio and set it as an environment variable:

Usage

Basic Text Generation

Streaming Responses

Structured Output

Configuration

Custom Provider Instance

Provider Options

  • apiKey: Your Google AI API key (defaults to GOOGLE_GENERATIVE_AI_API_KEY env var)
  • baseURL: Custom API endpoint URL
  • headers: Custom headers for requests

Available Models

Gemini 2.0 Family

  • gemini-2.0-flash - Fast and efficient
  • gemini-2.0-flash-exp - Experimental features

Gemini 1.5 Family

  • gemini-1.5-pro - Most capable model
  • gemini-1.5-flash - Fast and cost-effective

Advanced Features

Vision

Code Execution

Google Search Grounding

PDF Support

Embeddings

Available Models:
  • text-embedding-004 (768 dimensions)

Image Generation

Available Models:
  • imagen-3.0-generate-001 - Latest Imagen model

Model Capabilities

Resources