
MoltBot with Google Gemini - Setup & Configuration
Configure MoltBot to use Google Gemini AI. API setup, model selection, and optimization guide for Gemini integration.
Using MoltBot with Google Gemini
Google Gemini offers powerful AI capabilities with competitive pricing. This guide covers setting up MoltBot with Gemini models.
Why Gemini?
- Generous Free Tier: Free usage for Gemini 1.5 Flash
- Long Context: Up to 1M tokens context window
- Fast Response: Gemini Flash is optimized for speed
- Multimodal: Supports text, images, and video
- Cost Effective: Competitive pricing for Pro models
Getting Your API Key
Step 1: Access Google AI Studio
- Go to Google AI Studio
- Sign in with your Google account
- Click "Get API Key"
- Create a new API key or use existing one
Step 2: Save Your Key
# Set environment variable
export GOOGLE_AI_API_KEY="your-api-key-here"Or add to your shell profile:
echo 'export GOOGLE_AI_API_KEY="your-api-key-here"' >> ~/.zshrc
source ~/.zshrcConfiguration
Basic Setup
Configure MoltBot to use Gemini:
moltbot config set aiProvider google
moltbot config set googleModel gemini-1.5-flashOr edit ~/.moltbot/config.json:
{
"aiProvider": "google",
"google": {
"apiKey": "your-api-key-here",
"model": "gemini-1.5-flash",
"maxTokens": 8192
}
}Available Models
| Model | Best For | Context | Speed |
|---|---|---|---|
gemini-1.5-flash | Fast responses, cost-effective | 1M tokens | Fast |
gemini-1.5-pro | Complex reasoning, analysis | 1M tokens | Medium |
gemini-1.0-pro | Legacy support | 32K tokens | Medium |
Model Selection
Choose based on your needs:
# For fast, everyday tasks
moltbot config set googleModel gemini-1.5-flash
# For complex analysis
moltbot config set googleModel gemini-1.5-proAdvanced Configuration
Temperature and Creativity
{
"google": {
"model": "gemini-1.5-flash",
"temperature": 0.7,
"topP": 0.9,
"topK": 40
}
}Safety Settings
Configure content filtering:
{
"google": {
"safetySettings": {
"harassmentThreshold": "BLOCK_ONLY_HIGH",
"dangerousContentThreshold": "BLOCK_ONLY_HIGH"
}
}
}Options:
BLOCK_NONEBLOCK_ONLY_HIGHBLOCK_MEDIUM_AND_ABOVEBLOCK_LOW_AND_ABOVE
Long Context
Leverage Gemini's 1M token context:
{
"google": {
"model": "gemini-1.5-flash",
"maxInputTokens": 1000000
},
"memory": {
"maxContextTokens": 500000
}
}Multimodal Capabilities
Image Understanding
Gemini can analyze images:
moltbot chat "What's in this image?" --image /path/to/image.jpgDocument Analysis
Process long documents:
moltbot analyze /path/to/document.pdfUsage Examples
Chat with Gemini
# Start interactive chat
moltbot chat
# One-off query
moltbot ask "Explain quantum computing in simple terms"With Messaging Platforms
Gemini works with all MoltBot integrations:
# Telegram with Gemini
moltbot config set telegram.enabled true
moltbot config set aiProvider google
# Start
moltbot startCost Optimization
Free Tier Usage
Gemini 1.5 Flash has a generous free tier:
- 15 requests per minute
- 1 million tokens per minute
- 1,500 requests per day
Monitoring Usage
Check your usage:
moltbot stats usageCost Saving Tips
- Use Flash for simple tasks: Default to
gemini-1.5-flash - Cache responses: Enable caching for repeated queries
- Compress context: Summarize long conversations
{
"google": {
"model": "gemini-1.5-flash"
},
"cache": {
"enabled": true,
"ttl": 3600
},
"memory": {
"summarizeAfterTokens": 50000
}
}Comparison with Other Providers
| Feature | Gemini | Claude | GPT-4 |
|---|---|---|---|
| Free Tier | Yes | No | No |
| Max Context | 1M | 200K | 128K |
| Speed | Fast | Medium | Medium |
| Image Support | Yes | Yes | Yes |
| Code Quality | Good | Excellent | Excellent |
Switching Between Models
MoltBot supports multiple AI providers. You can switch dynamically:
# Use Gemini for fast tasks
moltbot ask "Quick question" --provider google --model gemini-1.5-flash
# Use Claude for complex tasks
moltbot ask "Complex analysis" --provider anthropic --model claude-3-sonnetOr set per-skill:
{
"skills": {
"quickAnswer": {
"aiProvider": "google",
"model": "gemini-1.5-flash"
},
"deepAnalysis": {
"aiProvider": "anthropic",
"model": "claude-3-opus"
}
}
}Troubleshooting
API Key Errors
Error: Invalid API keySolution:
- Verify key at Google AI Studio
- Check for extra spaces or newlines
- Regenerate key if needed
Rate Limit Errors
Error: Rate limit exceededSolution:
- Wait and retry
- Reduce request frequency
- Consider upgrading to paid tier
Safety Filter Blocks
If content is blocked:
- Review safety settings
- Adjust thresholds in config
- Rephrase your query
Regional Availability
Gemini is available in most regions. Check Google's documentation for specific availability.
Start using MoltBot with Gemini today! Need help? Join our Discord community.
Categories
More Posts

Run MoltBot on Mac Mini - 24/7 Home Server Guide
Deploy MoltBot on Mac Mini for always-on AI assistant. Apple Silicon optimization and home server setup guide.

MoltBot Windows Installation - Complete Setup Guide
How to install MoltBot on Windows 10/11. Detailed guide for Windows users with step-by-step instructions.

AI Model Support: Claude, GPT, and Local Models
MoltBot supports multiple AI models including Claude, GPT, and local models. Learn how to choose and configure the right AI backend for your needs.
Newsletter
Join the community
Subscribe to our newsletter for the latest news and updates