Docs / Strand / connectors/ai-google

Google Gemini Connector

Send prompts to Google Gemini models and receive completions from your Strand workflows. Use this connector for summarization, classification, content generation, data extraction, and any task that benefits from a large language model.

Direction: Read / Write | Type: ai.google

Prerequisites

You need a Google AI API key:

  1. Go to aistudio.google.com/apikey
  2. Click Create API key
  3. Select or create a Google Cloud project
  4. Copy the generated key

This key uses the Google Generative Language API (Google AI Studio), not Vertex AI. No Google Cloud billing setup is required for the free tier.

Connector Setup

Create a Google Gemini connector from the Connectors page.

Configuration Fields

Field Required Default Description
Name Yes - Friendly name (e.g., "Gemini Production")
API Key Yes - Google AI API key (encrypted at rest)
Model No gemini-2.5-flash Default model for all nodes using this connector
Temperature No 0.7 Response randomness (0--2). Lower = more deterministic
Max Tokens No 1000 Maximum response tokens (1--8,192)
Timeout No 120 Request timeout in seconds (10--600)

Operations

Chat Completion

Generate a chat completion response from a Gemini model. This is the single operation exposed by the connector.

Operation ID: chat

The prompt is sent as a user message. If System Instructions are configured on the node, they are sent as the system instruction preceding the prompt.

Models

Model Best for
gemini-2.0-flash Fast, cost-effective for most tasks (default)
gemini-2.0-flash-lite Fastest and cheapest option
gemini-2.5-flash Enhanced reasoning with speed
gemini-2.5-flash-lite Lightweight version of 2.5 Flash
gemini-2.5-pro Highest capability for complex tasks
gemini-1.5-pro Previous generation, large context
gemini-1.5-flash Previous generation, fast
gemini-1.5-flash-8b Previous generation, smallest

You can use any valid Google AI model name.

Node Configuration

When you drag a Google Gemini connector node onto the canvas, these fields are available in the node inspector. They apply to this specific node and override connector-level defaults where noted.

Field Required Default Description
Prompt Yes `{{ payload \ tojson }}` Prompt sent to the model. Supports Jinja2 templates
System Instructions No - Markdown instructions that set the model's persona and behavior
Model No connector default Override the model for this node only
Temperature No connector default Override temperature (0 = deterministic, 2 = most creative)
Max Tokens No connector default Override maximum response tokens
Timeout No connector default Override request timeout in seconds (10--600)
Max Retries No 2 Retries on transient errors such as rate limits and server errors (0--5)
MCP Servers No - MCP server connectors to attach as tools for this call
Memory Enabled No false Persist conversation history across workflow runs
Memory TTL No 3600 Seconds to retain history (60--2,592,000). Resets on each access
Memory Max Messages No 20 Maximum messages kept in memory. Oldest are trimmed first (2--100)

Output

A successful chat completion returns:

json

{
  "response": "Here is a summary of the provided data...",
  "model": "gemini-2.0-flash",
  "provider": "google",
  "usage": {
    "prompt_tokens": 150,
    "completion_tokens": 89,
    "total_tokens": 239
  }
}

When memory is enabled, the output includes "memory_enabled": true. When MCP tools are called, the output includes an "mcp_tools_called" array. If retries occurred, a "retries" count is included.

Access the response in downstream nodes:

jinja2

{{ steps.NODE_ID.output_payload.response }}
{{ steps.NODE_ID.output_payload.usage.total_tokens }}

Example Workflow

Extract structured data from incoming emails:

  1. HTTP Trigger receives a webhook with { "subject": "...", "body": "...", "from": "..." }
  2. Google Gemini node extracts fields:
  1. Python Snippet node parses the JSON response
  2. Router node branches on the extracted intent and urgency fields to route the email

Retries

The node automatically retries on transient errors -- rate limits (429), server errors (5xx), timeouts, and connection failures. Retries use exponential backoff with jitter and respect Retry-After headers from Google. Non-retryable errors (invalid API key, bad request) fail immediately.

Conversation Memory

Toggle Memory Enabled on and the node will remember every exchange across workflow runs. Each node gets its own isolated, account-scoped memory that is securely persisted across runs. See AI Connectors for full details on memory behavior, TTL, trimming, and when to enable it.

MCP Tool Access

AI nodes can call external tools via MCP servers. Add one or more MCP server connectors to the MCP Servers field and the model will have access to those tools during its response.

Errors

Error Meaning
Google AI API key is required API key not configured on the connector
Invalid Google AI API key Key is incorrect or revoked. Generate a new one
Rate limit exceeded Too many requests. The node will retry automatically
Request timeout The model took too long. Increase the timeout setting