Using Gemini with ClawdBot

Google's multimodal AI with generous free tier. Great for general tasks and experimentation.

🌟 Why Use Gemini?

Advantages

  • Generous Free Tier - 60 requests/minute free
  • Multimodal - Text, images, video, audio
  • Long Context - Up to 2M tokens (Gemini 1.5 Pro)
  • Fast - Low latency responses
  • Google Integration - Search, Maps, YouTube

Gemini Models

Model Context Free Tier Best For
Gemini 1.5 Pro 2M tokens ✅ Yes Complex tasks, long documents
Gemini 1.5 Flash 1M tokens ✅ Yes Fast responses, high volume
Gemini 1.0 Pro 32K tokens ✅ Yes General use (legacy)

🔑 API Setup

Step 1: Get API Key

  1. Go to Google AI Studio
  2. Sign in with Google account
  3. Click "Get API Key"
  4. Click "Create API Key"
  5. Copy the key

Step 2: Configure ClawdBot

# Method 1: Environment Variable
export GOOGLE_API_KEY="AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

# Method 2: Config File
# Edit ~/.clawdbot/config.yaml
providers:
  google:
    apiKey: "AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    model: "gemini-1.5-pro-latest"

# Method 3: Interactive
clawdbot config set google.apiKey

Step 3: Test

clawdbot test google
clawdbot chat --model gemini "Hello Gemini!"

🎯 Model Selection

Gemini 1.5 Pro (Recommended)

providers:
  google:
    model: "gemini-1.5-pro-latest"
    maxTokens: 8192
    temperature: 0.7

Best for: Complex reasoning, long documents, multimodal tasks

Gemini 1.5 Flash (Fast & Cheap)

providers:
  google:
    model: "gemini-1.5-flash-latest"

Best for: Quick responses, high-volume use, simple tasks

Model Comparison

Feature 1.5 Pro 1.5 Flash
Speed Medium Very Fast
Quality Excellent Good
Cost (paid tier) $7/1M tokens $0.35/1M tokens
Context Window 2M tokens 1M tokens

⚙️ Configuration

Complete Config

providers:
  google:
    apiKey: "${GOOGLE_API_KEY}"
    model: "gemini-1.5-pro-latest"
    
    # Generation parameters
    maxTokens: 8192
    temperature: 0.9
    topP: 1.0
    topK: 40
    
    # Safety settings
    safetySettings:
      HARM_CATEGORY_HARASSMENT: BLOCK_NONE
      HARM_CATEGORY_HATE_SPEECH: BLOCK_NONE
      HARM_CATEGORY_SEXUALLY_EXPLICIT: BLOCK_NONE
      HARM_CATEGORY_DANGEROUS_CONTENT: BLOCK_NONE
    
    # Rate limiting
    maxRequestsPerMinute: 60  # Free tier limit
    
    # Timeout
    timeout: 60000

Safety Settings

Gemini has built-in safety filters. Adjust as needed:

  • BLOCK_NONE - No filtering
  • BLOCK_ONLY_HIGH - Block high-risk content
  • BLOCK_MEDIUM_AND_ABOVE - Block medium+ risk
  • BLOCK_LOW_AND_ABOVE - Strict filtering

✨ Gemini Features

Multimodal Input

# Text + Image
You: [Upload image] What's in this picture?
Gemini: I see a sunset over mountains...

# Text + Video
You: [Upload video] Summarize this video
Gemini: This video shows...

# Text + Audio
You: [Upload audio] Transcribe this
Gemini: [Transcription]

Long Context Processing

# Process entire books, codebases
You: [Upload 500-page PDF]
You: Summarize the key arguments
Gemini: [Comprehensive summary]

Google Search Integration

# Enable grounding with Google Search
providers:
  google:
    enableGrounding: true

You: What are the latest AI developments?
Gemini: [Searches web, provides current info with citations]

💰 Pricing

Free Tier (Generous!)

Model RPM Limit TPM Limit RPD Limit
Gemini 1.5 Pro 2 RPM 32K TPM 50 RPD
Gemini 1.5 Flash 15 RPM 1M TPM 1500 RPD

RPM = Requests Per Minute, TPM = Tokens Per Minute, RPD = Requests Per Day

Paid Tier

Model Input Cost Output Cost
Gemini 1.5 Pro $3.50/1M tokens $10.50/1M tokens
Gemini 1.5 Flash $0.075/1M tokens $0.30/1M tokens

Cost Comparison

For 1000 messages (avg 500 tokens each):

  • Gemini 1.5 Flash: ~$0.19
  • Gemini 1.5 Pro: ~$5.25
  • Claude 3.5 Sonnet: ~$9.00
  • GPT-4: ~$15.00

❓ Gemini FAQ

Is Gemini really free?
Yes! The free tier is generous enough for personal use. Paid tier only needed for high-volume or commercial use.
How does Gemini compare to Claude for coding?
Claude is generally better for complex coding tasks. Gemini is good for general code and excels at multimodal tasks.
Can I use Gemini offline?
No, Gemini requires internet connection. For offline AI, use Ollama with local models.
What's the context window size?
Gemini 1.5 Pro: 2M tokens (largest available!), Gemini 1.5 Flash: 1M tokens.

📚 Related Guides