Connecting Your Gemini API
Table of Contents
This guide shows you how to connect a Google Gemini API key to your Agento agent.
Prerequisites
Before you start, make sure you have:
- An Agento account with at least one agent created
- A Google Cloud account or Google AI Studio access
Get Your API Key
The easiest way to get a Gemini API key is through Google AI Studio:
- Go to aistudio.google.com
- Click Get API Key in the top navigation
- Click Create API Key
- Select a Google Cloud project (or create a new one)
- Copy the generated API key
Alternatively, you can create a key through the Google Cloud Console under APIs & Services > Credentials.
Add the Key to Your Agent
- Open the Agento dashboard and click on your agent
- Go to the Settings tab
- Under AI Provider, select Google Gemini
- Paste your API key into the API Key field
- Click Save
Your key is encrypted at rest and never displayed again after saving.
Choose a Model
After saving your API key, select which Gemini model to use:
| Model | Best For |
|---|---|
| Gemini 2.5 Pro | Complex reasoning and multi-step tasks |
| Gemini 2.5 Flash | Fast responses at lower cost |
You can switch models at any time without re-entering your API key.
Verify the Connection
Start your agent (or restart it if already running). Send a test message through web chat or Telegram. If the agent responds, your Gemini API is connected.
Troubleshooting
"Invalid API key" error: Make sure you copied the full key. Gemini API keys start with AI.
Agent returns errors: Check that the Gemini API is enabled for your Google Cloud project. Go to APIs & Services > Enabled APIs and search for "Generative Language API".
Rate limit errors: Free-tier keys have lower rate limits. Consider upgrading to a paid tier for production use at aistudio.google.com/plan-info.