Skip to main content
Avante.nvim supports multiple AI providers, giving you flexibility in choosing the best model for your workflow. You can easily switch between providers and configure them to suit your needs.

Available Providers

ProviderTypeAuthenticationKey Features
ClaudeCloud APIAPI Key or OAuthAnthropic’s powerful models with extended thinking
OpenAICloud APIAPI KeyGPT-4o, reasoning models, Response API
Azure OpenAICloud APIAPI KeyMicrosoft-hosted OpenAI models
GeminiCloud APIAPI KeyGoogle’s Gemini models with large context
CopilotCloud APIOAuthGitHub Copilot integration
OllamaLocalNoneRun models locally with Ollama
CustomVariesVariesCreate your own provider

Switching Providers

During Runtime

You can switch providers at any time using the command:
:AvanteSwitchProvider <provider-name>
Or use the keyboard shortcut:
<Leader>a?  " Select model (opens provider/model selector)

In Configuration

Set the default provider in your configuration:
{
  "yetone/avante.nvim",
  opts = {
    provider = "claude", -- Default provider
  },
}

Provider Comparison

Performance

  • Fastest: Claude (Sonnet 4), Gemini (Flash)
  • Most Capable: Claude (Opus 4), OpenAI (GPT-4o)
  • Best for Reasoning: OpenAI (o1, o3-mini), Claude (with thinking)
  • Local/Private: Ollama

Context Window

  • Largest: Gemini (1M+ tokens)
  • Claude: 200K tokens
  • OpenAI: 128K tokens
  • Copilot: 64K tokens

Cost Considerations

  • Free Options: Ollama (local), Copilot (with subscription)
  • Pay-per-use: OpenAI, Claude, Gemini
  • Enterprise: Azure OpenAI, AWS Bedrock

API Key Management

Avante supports two methods for setting API keys: Isolate API keys specifically for Avante by prefixing with AVANTE_:
export AVANTE_ANTHROPIC_API_KEY=your-claude-api-key
export AVANTE_OPENAI_API_KEY=your-openai-api-key
export AVANTE_GEMINI_API_KEY=your-gemini-api-key

Global Keys

Use standard environment variable names:
export ANTHROPIC_API_KEY=your-api-key
export OPENAI_API_KEY=your-api-key
export GEMINI_API_KEY=your-api-key
Scoped keys (AVANTE_*) take precedence over global keys.

Provider Configuration Structure

All providers share a common configuration structure:
providers = {
  provider_name = {
    endpoint = "https://api.example.com",
    model = "model-name",
    timeout = 30000, -- milliseconds
    context_window = 128000, -- tokens
    extra_request_body = {
      temperature = 0.75,
      max_tokens = 4096,
    },
  },
}

Common Options

  • endpoint: API endpoint URL
  • model: Model identifier
  • timeout: Request timeout in milliseconds
  • context_window: Maximum context size in tokens
  • api_key_name: Environment variable name for API key
  • extra_request_body: Provider-specific parameters
  • proxy: HTTP proxy URL (optional)
  • allow_insecure: Allow insecure connections (optional)

Advanced Features

Dual Boost Mode

Combine responses from two providers for enhanced quality:
dual_boost = {
  enabled = true,
  first_provider = "openai",
  second_provider = "claude",
  timeout = 60000,
}

Auto-Suggestions Provider

Use a different provider for auto-suggestions:
auto_suggestions_provider = "claude"
Auto-suggestions are high-frequency operations. Using expensive providers like Copilot can be costly.

Troubleshooting

Provider Not Working

  1. Check API Key: Ensure your API key is set correctly
    :echo $ANTHROPIC_API_KEY
    
  2. Verify Provider Setup: Check if the provider is configured
    :lua print(vim.inspect(require('avante.config').providers.claude))
    
  3. Check Login Status: Ensure authentication succeeded
    :lua print(vim.g.avante_login)
    

Rate Limiting

If you encounter rate limits:
  • Increase the timeout value
  • Reduce request frequency
  • Consider upgrading your API plan

Network Issues

For proxy or network problems:
providers = {
  claude = {
    proxy = "http://proxy.example.com:8080",
    allow_insecure = false, -- Set to true only if necessary
  },
}

Next Steps

Build docs developers (and LLMs) love