# Google Gemini Vision Configuration Troubleshooting

## Problem
When configuring Hermes Agent to use Google Gemini for vision analysis, common errors include:
- **Error 429**: "current subscription plan does not include access to GLM-5V-Turbo"
- **Error 404**: "Unknown Model, please check model code"
- **Error 404**: "models/gemini-X is not found for API version v1main, or is not supported for generateContent"

## Working Configuration

### Quick Fix (Recommended)
Use the experimental model name and set all config parameters explicitly:

```bash
# Set provider and model
hermes config set auxiliary.vision.provider google
hermes config set auxiliary.vision.model gemini-2.5-pro-exp
hermes config set auxiliary.vision.api_key YOUR_GOOGLE_API_KEY
hermes config set auxiliary.vision.base_url https://generativelanguage.googleapis.com/v1beta
```

### Verification
After configuration, restart the gateway for changes to take effect:
```bash
# In WeChat/gateway
/restart

# Or via command line
hermes gateway restart
```

## What Didn't Work

The following model names returned "Unknown Model" or "model not found" errors:
- `gemini-2.0-flash` - not recognized
- `gemini-1.5-flash` - not recognized
- `gemini-1.5-pro` - not recognized for v1main
- `gemini-pro-vision` - not recognized
- `gemini-pro` - not recognized for v1main

## Key Learnings

1. **Base URL Format**: Must use `https://` not `https://` (typo causes connection errors)
2. **API Version**: Use `v1beta` endpoint - `v1main` does not support vision/generateContent
3. **Model Naming**: Use experimental model name `gemini-2.5-pro-exp` for vision support
4. **Provider Explicitly Set**: Don't rely on auto-detection for Google Gemini - set provider explicitly to `google`
5. **Restart Required**: Config changes to auxiliary services require gateway restart (`/restart` in messaging platforms)

## Free Google Gemini API Key

Get a free API key at: https://aistudio.google.com/app/apikey

## Alternative: OpenRouter with Free Models

If Google Gemini doesn't work, OpenRouter provides access to Google Gemini and other free models:

```bash
# Get key: https://openrouter.ai/keys
hermes config set auxiliary.vision.provider openrouter
hermes config set auxiliary.vision.api_key YOUR_OPENROUTER_API_KEY
hermes config set auxiliary.vision.model google/gemma-3-12b-it:free
```

## Verification

Test vision analysis after configuration:

```python
# This is automatically done by vision_analyze tool when user sends an image
# No manual test needed in normal usage
```

If vision still fails, check:
1. API key is valid (test via curl or API console)
2. Base URL is correct (https://, not https://)
3. Gateway has been restarted after config changes
4. Config yaml has correct indentation (no syntax errors)
