Why Google AI Studio?
Native Search Grounding
Gemini can search the web and cite sources in its responses
Generous Free Tier
15 requests/minute and 1,500 requests/day at no cost
Latest Gemini Models
Access to Gemini 2.5 Pro, Flash, and Flash Lite
Multimodal Support
Native image, video, and audio understanding
Setup
Get your API key
- Go to Google AI Studio
- Click Get API key or Create API key
- Select a Google Cloud project (or create a new one)
- Copy your API key
The API key is free to generate and includes a generous free tier. No credit card required.
Add connection in Craft Agents
- Open Settings → AI Connections
- Click Add Connection
- Select Google AI Studio
- Paste your API key
- Choose your default model (e.g.,
gemini-2.5-pro) - Click Save
Available Models
Craft Agents automatically detects Gemini models available on your API key:Legacy models (1.5-series and 2.0-flash) do not support Google Search grounding or all function calling features.
packages/shared/src/config/models-pi.ts:45-55
Native Google Search Grounding
Gemini models have built-in access to Google Search. When you ask a question requiring current information, Gemini automatically searches the web and cites sources.How It Works
Agent uses web_search tool
When connected to Google AI Studio, Craft Agents exposes a
web_search tool that makes a separate Gemini API call with { googleSearch: {} } grounding enabled.The Gemini API doesn’t allow combining Google Search grounding with function calling in the same request. So we expose it as an explicit tool instead.
Implementation Details
The Google Search tool is implemented in the Pi Agent Server:packages/pi-agent-server/src/tools/google-search.ts:20-106
Pricing
Google AI Studio offers a generous free tier:| Model | Free Tier | Paid Pricing (Input/Output) |
|---|---|---|
| Gemini 2.5 Pro | 15 RPM / 1,500 RPD | 5.00 per 1M tokens |
| Gemini 2.5 Flash | 15 RPM / 1,500 RPD | 1.20 per 1M tokens |
| Gemini 2.5 Flash Lite | 15 RPM / 1,500 RPD | 0.60 per 1M tokens |
RPM = Requests per minute
RPD = Requests per dayGoogle Search grounding is included at no extra cost.
RPD = Requests per dayGoogle Search grounding is included at no extra cost.
Multimodal Support
Gemini models natively support images, videos, and audio. In Craft Agents:- Images: Drag and drop PNG, JPEG, WebP files
- Videos: MP4, MOV (up to 10 minutes)
- Audio: MP3, WAV, OGG
- Documents: PDF (automatically converted to images)
Troubleshooting
API key invalid
API key invalid
Error:
Authentication failed. Check your API key or OAuth token.Solutions:- Verify you copied the full API key from Google AI Studio
- Ensure the API key is associated with an active Google Cloud project
- Check that the Google AI API is enabled in your project
Rate limits exceeded
Rate limits exceeded
Error:
Rate limited or quota exceeded. Try again later.Free tier limits:- 15 requests per minute
- 1,500 requests per day
Google Search not working
Google Search not working
Problem: The
web_search tool isn’t being used or returns generic results.Check:- Ensure your connection’s
piAuthProvideris set togoogle(this should happen automatically) - Verify you’re using a Gemini 2.5 model (not 1.5 or 2.0)
- Try explicitly asking the agent to “search the web” or “look up current information”
The Google Search tool is only injected when the Pi auth provider is
google. Other providers use DuckDuckGo instead.Model not found
Model not found
Error:
Model not found. Check the connection configuration.Some models may not be available in all regions:- Check Google AI Studio for model availability
- Try switching to
gemini-2.5-flash(most widely available)
Example: Using Google Search
Here’s a sample conversation demonstrating native Google Search grounding:Next Steps
Add More Providers
Connect to OpenRouter, Ollama, or custom endpoints
Configure Workspaces
Set per-workspace default models