Connect to Google Gemini
Connect to Google Gemini and use their models for AI-powered apps and automations in Retool.
AI resource integrations are rolling out on cloud instances and will be available for self-hosted instances in a future release. Continue to use the Retool AI resource with Google Gemini models if this feature isn't yet available for your organization.
Google Gemini provides advanced AI models for text, image, audio, and video understanding through the Gemini API. You can create a Google Gemini resource so you can build AI-powered apps and workflows that leverage advanced multimodal processing, long context windows, and Google's AI infrastructure.
What you can do with Google Gemini
With a Google resource, you can interact with LLMs to perform various actions, including:
Text actions
| Action | Description |
|---|---|
| Generate text | Create original text content based on your prompt. Use for content generation, creative writing, code generation, and general-purpose text tasks. |
| Summarize text | Condense long-form content into concise summaries. Specify the input text and desired summary format. |
| Classify text | Categorize text into predefined categories. Provide the text to classify and the possible categories. |
| Extract entity from text | Extract specific information from unstructured text. Define what entities or data points to extract (names, dates, amounts, etc.). |
Chat actions
| Action | Description |
|---|---|
| Generate chat response | Create contextual responses in multi-turn conversations. The AI model considers previous messages to maintain conversation flow. |
Image actions
| Action | Description |
|---|---|
| Generate text from image | Analyze images and generate descriptive text. Upload an image or provide an image URL, then ask questions or request analysis. |
| Caption image | Generate descriptive captions for images. Provide an image and optionally specify the caption style or focus. |
Supported models
When you configure a Google Gemini resource with your own API key, Retool interacts directly with the Google AI API. You can use any Gemini model you have access to through your Google account, including:
- All current and future Gemini models
- Experimental and preview models
- Models with extended context windows
- Specialized variants (Pro, Flash, Nano)
Specify the model ID in your queries (e.g., gemini-3-pro-preview, gemini-2.5-flash). Refer to Google's Gemini documentation for the complete list of available models and their identifiers.
Before you begin
Before creating a Google Gemini resource, you need:
- Retool permissions: Ability to create and manage resources in your Retool organization.
- Google AI API key: An API key from Google AI Studio.
- Enabled Gemini API: The Gemini API enabled in your Google Cloud project.
Create a Google Gemini resource
Create a resource to connect Retool to Google Gemini and configure authentication. Once connected, you can then select it when writing queries to make use of its available models.
Follow these steps to create a Google Gemini resource in Retool.
1. Create a new resource
Navigate to Resources in the main navigation and click Create new > Resource and search for Google Gemini. Then, click the Google Gemini tile to create a new resource.
2. Configure connection settings
Specify a name for the resource that identifies it within your organization. Include a description that can provide more context to users and Assist about how to use the resource.
3. Configure authentication
This resource requires you to provide your own API key. Retool-managed keys are not available for Google Gemini.
Google Gemini resources require an API key for authentication.
- API Key: Your Google AI API key from Google AI Studio. This is required.
- Base URL (optional): The Gemini API endpoint. Default is
https://generativelanguage.googleapis.com. Only change this if you're using a custom endpoint or regional deployment.
Retrieve your API key from Google AI Studio. If you don't have a key, click Create API key to generate one.
Create dedicated API keys for Retool to best manage and revoke access without disruption. All API keys used with Retool are .
4. Save the resource
Click Create resource to save your Google Gemini resource. The resource is now available for use in apps and workflows.
AI resources do not have a Test connection button. Verify your configuration by creating a query and running it in your app or workflow.
Query Google Gemini data
Create queries against your Google Gemini resource to interact with Gemini models in your Retool apps and workflows.
Create a query
In your Retool app or workflow, create a new query and select your Google Gemini resource from the resource dropdown. Choose an action type to configure what you want Gemini to do.

Action types
Google Gemini resources support the following action types:
Text actions
Process and generate text using Gemini's language understanding capabilities.
| Action | Description |
|---|---|
| Generate text | Create original text content based on your prompt. Use for content generation, creative writing, code generation, and general-purpose text tasks. |
| Summarize text | Condense long-form content into concise summaries. Specify the input text and desired summary format. |
| Classify text | Categorize text into predefined categories. Provide the text to classify and the possible categories. |
| Extract entity from text | Extract specific information from unstructured text. Define what entities or data points to extract (names, dates, amounts, etc.). |
Chat actions
Generate conversational responses based on message history and context.
| Action | Description |
|---|---|
| Generate chat response | Create contextual responses in multi-turn conversations. The AI model considers previous messages to maintain conversation flow. |
Vision actions
Analyze and understand images using Gemini's multimodal capabilities.
| Action | Description |
|---|---|
| Generate text from image | Analyze images and generate descriptive text. Upload an image or provide an image URL, then ask questions or request analysis. |
| Caption image | Generate descriptive captions for images. Provide an image and optionally specify the caption style or focus. |
Configuration options
You can configure the following options when querying a Google Gemini resource.
| Option | Description |
|---|---|
| Model | The Gemini model to use. Different models offer different capabilities, speeds, costs, and context windows. Refer to the Supported models section for available options. |
| Temperature | Determines the randomness in responses. Accepts a decimal number between 0.0 to 2.0. Lower values (0.0-0.3) are more focused and deterministic. Medium values (0.4-0.7) are balanced. Higher values (0.8-2.0) are more creative. Not all models support temperature control. |
| System message | Provides detailed instructions for the model's behavior. Use it to define the model's role, response format, or domain expertise. The system message only needs to be defined once and applies to all interactions. It's useful for keeping longer instruction sets separate from the prompt or other values. |
| Prompt | The main input or question for Gemini. Can use {{ }} dynamic expressions to reference component values or query data. |
Not all models provide support for controlling temperature. If you select a model that does not use this option, Retool removes it from the query editor.
You are a helpful SQL expert. Provide concise, accurate answers with code examples when relevant.
Analyze this feedback: {{ feedbackTextarea.value }}
Common use cases
The following examples demonstrate typical Google Gemini integrations in Retool apps.
Analyze images and extract data
Create a query that analyzes images and extracts structured information.
Query example
| Setting | Value |
|---|---|
| Model | gemini-2.0-flash |
| Temperature | 0.2 |
You are an image analysis expert. Extract data from images and charts, returning structured information in JSON format.
[
{
role: "user",
content: [
{
type: "text",
text: "Analyze this image and extract: 1) Main objects/subjects, 2) Any visible text or numbers, 3) Key visual elements. Return as JSON."
},
{
type: "image",
image: {{ fileInput.value[0].base64 }}
}
]
}
]
Use this query with a File Input component for image upload and a Table component to display extracted data.
Process long documents with large context
Analyze extensive documents using Gemini's long context window capabilities.
Query example
| Setting | Value |
|---|---|
| Model | gemini-1.5-pro |
| Temperature | 0.3 |
You are a document analyst. Analyze long documents and provide comprehensive summaries with key points, themes, and actionable insights.
Analyze this document and provide:
1. Executive summary (2-3 paragraphs)
2. Key themes (list 5-7)
3. Important facts and figures
4. Actionable recommendations (list 3-5)
Document ({{ documentText.value.length }} characters):
{{ documentText.value }}
Gemini 1.5 Pro supports up to 2 million tokens, allowing analysis of extensive documents, codebases, or combined datasets.
Generate SQL from natural language
Convert natural language questions into SQL queries for your database.
Query example
| Setting | Value |
|---|---|
| Model | gemini-1.5-flash |
| Temperature | 0.2 |
You are a SQL expert. Convert natural language questions into PostgreSQL queries. Return only the SQL query without explanations. Use the following schema: Tables: customers (id, name, email, created_at), orders (id, customer_id, total, status, order_date), products (id, name, price, category)
{{ questionInput.value }}
Chain this query with a PostgreSQL query that executes the generated SQL to display results.
Create structured data from unstructured text
Parse unstructured content and extract structured information in JSON format.
Query example
| Setting | Value |
|---|---|
| Model | gemini-1.5-flash |
| Temperature | 0.1 |
Extract structured information from the provided text and return ONLY valid JSON. No explanations or additional text.
Extract contact information from this business card text and return as JSON:
- name
- title
- company
- email
- phone
- address
Text:
{{ businessCardText.value }}
Use the response in a Table component or process it with JavaScript transformers to update your CRM.