The Gemini provider supports all Google Gemini models including Gemini 2.0, 1.5 Pro, Flash, and vision capabilities.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nullclaw/nullclaw/llms.txt
Use this file to discover all available pages before exploring further.
Configuration
Set to
"gemini" or "google" or "google-gemini"Google API key. Get yours at aistudio.google.com/apikey
Model name:
gemini-2.0-flash, gemini-1.5-pro, etc.Sampling temperature (0.0-2.0). Defaults to
0.7.Maximum output tokens (called
maxOutputTokens in Gemini API). Defaults to 8192.Example Configuration
Authentication Methods
The Gemini provider supports three authentication methods (in priority order):1. Explicit API Key (Config)
2. Environment Variables
3. Gemini CLI OAuth Token
Reuse existing Gemini CLI credentials from~/.gemini/oauth_creds.json:
- Detects and loads the token
- Checks expiration (5-minute safety buffer)
- Refreshes expired tokens using the refresh token
- Persists refreshed tokens back to
~/.gemini/oauth_creds.json
gemini auth login and NullClaw will use those credentials.
Supported Models
- Gemini 2.0:
gemini-2.0-flash,gemini-2.0-flash-exp - Gemini 1.5:
gemini-1.5-pro,gemini-1.5-flash,gemini-1.5-flash-8b - Legacy:
gemini-pro,gemini-pro-vision
models/ prefix:
gemini-2.0-flash→ auto-expanded tomodels/gemini-2.0-flashmodels/gemini-1.5-pro→ used as-is
Capabilities
| Feature | Support |
|---|---|
| Streaming | Yes |
| Function Calling | No (planned) |
| Vision (images) | Yes |
| System Messages | Yes (via system_instruction) |
| Tool Calls | No |
Message Format
Gemini uses a different message format:- Roles are
userandmodel(notassistant) - System messages go in top-level
system_instructionfield - Content is structured as
partsarray
Vision Support
Gemini supports multimodal input (text + images):inlineData. Image URLs are converted to text references: [Image: https://example.com/photo.jpg].
Streaming
Gemini uses Server-Sent Events (SSE) for streaming: Endpoint:- Parses SSE lines
- Extracts
candidates[0].content.parts[0].text - Calls streaming callback for each delta
- Accumulates full response
OAuth Token Refresh
When using Gemini CLI credentials, the provider handles token refresh automatically:- Token is within 5 minutes of expiration
refresh_tokenis available
~/.gemini/oauth_creds.json.
Code Example
Fromsrc/providers/gemini.zig:
Error Handling
The provider classifies common Gemini API errors:error.RateLimited— 429 rate limit exceedederror.InvalidApiKey— Authentication failederror.ApiError— Generic API errorerror.NoResponseContent— Empty responseerror.RefreshFailed— OAuth token refresh failed