Skip to main content
Google’s Gemini models offer industry-leading context windows (up to 1M+ tokens) and powerful multimodal capabilities. Avante.nvim provides full support for Gemini’s API.

Quick Start

1

Get your API key

Get an API key from Google AI Studio.
2

Set environment variable

Add to your shell configuration:
3

Configure provider

Configuration

Basic Configuration

Available Models

Environment Variables

API Endpoint Structure

Gemini uses a unique endpoint structure:

Generation Configuration

Gemini uses generationConfig for model parameters:

Parameters

Tool Calling

Gemini uses a different format for function declarations:

Function Responses

Safety Settings

Gemini includes safety filters. If your prompt is blocked:
To adjust safety settings, add to your configuration:

Finish Reasons

Gemini responses include finish reasons:

Vertex AI

For Google Cloud Vertex AI, use the vertex provider:

Authentication

Vertex AI uses Google Cloud authentication:

Advanced Features

ReAct Prompting

Enable ReAct-style prompting for better tool use:

Stop Sequences

Custom stop sequences for ReAct mode:

Multimodal Input

Gemini supports image inputs:

Troubleshooting

Ensure your API key is set:
Get a key from Google AI Studio.
If your prompt is blocked:
  1. Review the blockReason in the error
  2. Adjust your prompt to be less sensitive
  3. Configure safety settings (use with caution)
For Vertex AI:
  1. Ensure gcloud is authenticated: gcloud auth list
  2. Check project ID in endpoint URL
  3. Verify service account permissions
Gemini has generous quotas, but if you hit limits:
  1. Check quota at Google Cloud Console
  2. Request quota increase
  3. Implement request throttling

Best Practices

Model Selection

  • Gemini 2.0 Flash: Latest, best performance
  • Gemini 1.5 Pro: Maximum capability
  • Gemini 1.5 Flash: Fastest responses

Context Window

  • 1M+ token context is unique to Gemini
  • Great for large codebases
  • Entire files can fit in context

Temperature Settings

  • 0.0-0.3: Focused, consistent
  • 0.4-0.7: Balanced (recommended)
  • 0.8-1.0: Creative, varied

Safety

  • Default filters are moderate
  • Adjust only when necessary
  • Review blocked content carefully

Example Configurations