Authentication Methods
API Key Authentication
The simplest method using a Gemini API key from Google AI Studio.1. Get API Key
- Visit Google AI Studio
- Create a new API key
- Copy the key
2. Configure Weaver
Option A: Configuration File Add to~/.weaver/config.json:
.env:
Google Cloud ADC Authentication
Use Google Cloud Application Default Credentials for automatic token management with Vertex AI.1. Set Up GCP Credentials
2. Configure Weaver
Add to~/.weaver/config.json:
The ADC method automatically refreshes access tokens and handles GCP authentication. This is recommended for production deployments using Vertex AI.
Available Models
Weaver supports all Gemini model variants:| Model | Description | Context Window |
|---|---|---|
gemini-3-flash-preview | Fast, efficient model (default) | 128K tokens |
gemini-2.0-flash-exp | Latest experimental model | 1M tokens |
gemini-1.5-pro | Most capable model | 2M tokens |
gemini-1.5-flash | Balanced speed and capability | 1M tokens |
Configuration Options
Gemini API key from Google AI Studio
Gemini API endpoint URL
Authentication method:
api_key (default) or gcloud-adc / adcHTTP/HTTPS proxy URL for API requests (optional)
Model Parameters
Configure model behavior:Maximum tokens in response (uses
max_completion_tokens for some models)Controls randomness in responses (0.0 = deterministic, 2.0 = very random)
Usage Examples
Using Specific Models
Specify model in conversation:With Proxy
Configure proxy for restricted networks:Implementation Details
Weaver’s Gemini integration uses:- HTTPProvider for API key authentication with OpenAI-compatible format
- VertexAIProvider for GCP ADC authentication with automatic token refresh
- OpenAI-compatible
/chat/completionsendpoint format - Automatic model namespace handling (strips
google/prefix)
pkg/providers/http_provider.go:299-417, pkg/providers/vertex_provider.go
Troubleshooting
API Key Issues
GCP ADC Issues
Common Errors
401 Unauthorized
401 Unauthorized
403 Permission Denied
403 Permission Denied
- Ensure Vertex AI API is enabled in your GCP project
- Verify your account has the necessary permissions
- For ADC: Check you have
cloud-platformscope
429 Rate Limit
429 Rate Limit
- Check your API quota in Google AI Studio
- Implement exponential backoff in your application
- Consider upgrading to a paid tier
Next Steps
Provider Overview
Back to all providers
Agent Configuration
Configure agents with Gemini