🟡 Gemini Models
Google Gemini (formerly Bard, PaLM 2) is Google's flagship family of large language models, offering state-of-the-art performance, massive context windows, and multimodal capabilities (text, images, audio, and more).
🌟 Why Choose Gemini?
Gemini Advantages
📊 Available Models
Model | Context Window | Best For | Input Cost | Output Cost |
---|---|---|---|---|
Gemini 1.5 Pro | 1M tokens | Research, long docs, multimodal | $7/1M tokens | $21/1M tokens |
Gemini 1.5 Flash | 128K tokens | Fast, cost-effective | $0.35/1M tokens | $1.05/1M tokens |
Gemini 1.0 Pro | 32K tokens | General purpose | $0.50/1M tokens | $1.50/1M tokens |
Source: Google Gemini Pricing
🚀 Getting Started
Step 1: Create Google Cloud Account
- Visit Google Cloud Console
- Sign up or log in with your Google account
- Create a new project for your AI usage
- Enable billing (required for API access)
Step 2: Enable Gemini API
- Go to Vertex AI API page
- Click "Enable"
- Wait for activation (usually instant)
Step 3: Generate API Key or Service Account
- Go to APIs & Services > Credentials
- Click "Create Credentials" > "API key"
- Copy the key and store securely
- (Optional): For advanced use, create a service account and download the JSON key
Step 4: Configure in MCP for WP
- Go to MCP for WP > Settings
- Find the "Gemini API Key" field
- Paste your API key
- Click "Test Connection" to verify
- Save settings
⚙️ Model Configuration
Default Settings
json
{
"model": "gemini-1.5-pro-latest",
"max_tokens": 2048,
"temperature": 0.7,
"top_p": 1.0
}
Parameter Guide
Model Selection
gemini-1.5-pro-latest
: Best for research, long docs, multimodalgemini-1.5-flash-latest
: Fast, cost-effectivegemini-1.0-pro-latest
: General purpose
Max Tokens
- Range: 1 to 8192 (varies by model)
- Recommendation: Start with 2048, adjust as needed
Temperature
- Range: 0.0 to 1.0
- 0.0: Deterministic
- 0.7: Balanced
- 1.0: Creative
Top P
- Range: 0.0 to 1.0
- 1.0: All tokens
- 0.9: Top 90% probability mass
💰 Pricing & Usage
Cost Calculator
Gemini Cost Calculation
Usage Limits
Plan | Rate Limit | Monthly Limit |
---|---|---|
Free Tier | 60 requests/minute | $300 credit/90 days |
Pay-as-you-go | 600 requests/minute | No limit |
Enterprise | Custom | Custom |
Source: Vertex AI Quotas
Cost Optimization Tips
- Use Gemini 1.5 Flash for fast, cheap tasks
- Set max_tokens to control cost
- Monitor usage in Google Cloud console
- Batch requests when possible
🔧 Advanced Configuration
Multimodal Inputs
Gemini supports text, images, and audio as input. In MCP for WP, use the input schema to allow file uploads or URLs.
Example:
json
{
"input_schema": {
"type": "object",
"properties": {
"text": { "type": "string" },
"image_url": { "type": "string", "format": "uri" }
},
"required": ["text"]
}
}
System Instructions
json
{
"system_instruction": "You are a helpful assistant."
}
🛠️ Use Cases & Examples
Research & Summarization
Tool Configuration:
json
{
"input_schema": {
"type": "object",
"properties": {
"document": { "type": "string", "description": "Text to summarize" },
"summary_type": { "type": "string", "enum": ["brief", "detailed"] }
},
"required": ["document"]
}
}
Recommended Settings:
- Model:
gemini-1.5-pro-latest
- Temperature: 0.3
- Max Tokens: 1024
Multimodal Analysis
Tool Configuration:
json
{
"input_schema": {
"type": "object",
"properties": {
"text": { "type": "string" },
"image_url": { "type": "string", "format": "uri" }
},
"required": ["text", "image_url"]
}
}
Recommended Settings:
- Model:
gemini-1.5-pro-latest
- Temperature: 0.5
- Max Tokens: 2048
Long Document Processing
Tool Configuration:
json
{
"input_schema": {
"type": "object",
"properties": {
"document": { "type": "string", "description": "Long document to process" },
"task": { "type": "string", "enum": ["extract", "analyze", "summarize"] }
},
"required": ["document", "task"]
}
}
Recommended Settings:
- Model:
gemini-1.5-pro-latest
- Temperature: 0.3
- Max Tokens: 4096
🔍 Troubleshooting
Common Issues
- API Key Invalid: Check Google Cloud credentials
- Quota Exceeded: Review quotas in Vertex AI
- Model Not Enabled: Ensure Gemini API is enabled
- Billing Issues: Check billing status in Google Cloud
Debugging Tips
- Check API key in Google Cloud console
- Monitor usage and billing
- Review request logs in MCP for WP
- Test with Vertex AI Studio
- Check quotas and limits
📚 Additional Resources
🔐 Security Best Practices
- Never expose API keys in client-side code
- Use IAM roles for service accounts
- Monitor usage for anomalies
- Rotate keys regularly
📞 Support
Ready to get started? Configure your Gemini integration or explore other providers!