Skip to main content
This guide will take you from a fresh installation to your first AI-powered code interaction in less than 5 minutes.

Before You Begin

Make sure you’ve completed the Installation steps and have Avante.nvim installed in your Neovim setup.

Step 1: Set Up Your API Key

1

Choose Your AI Provider

Avante.nvim supports multiple AI providers. For this quickstart, we’ll use Claude, but you can choose any supported provider:
  • Claude (Anthropic)
  • OpenAI (GPT-4, etc.)
  • Azure OpenAI
  • Gemini (Google)
  • Copilot
  • Ollama (local models)
  • And many more!
2

Get Your API Key

For Claude, get your API key from Anthropic’s website.For other providers, visit their respective platforms to obtain API keys.
3

Set the Environment Variable

Avante.nvim supports scoped API keys (recommended for isolation) by prefixing with AVANTE_:
# Recommended: Scoped keys (only for 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
Or use global API keys:
# Legacy: Global keys
export ANTHROPIC_API_KEY=your-claude-api-key
export OPENAI_API_KEY=your-openai-api-key
For most consistency between Neovim sessions, it’s recommended to set the environment variables in your shell configuration file (.bashrc, .zshrc, etc.).
If you don’t set the API key in advance, Avante will prompt you at startup to input the API key for the provider you have selected.

Step 2: Configure Your Provider

In your Neovim configuration, set your preferred provider:
require('avante').setup({
  provider = "claude", -- or "openai", "gemini", etc.
  providers = {
    claude = {
      endpoint = "https://api.anthropic.com",
      model = "claude-sonnet-4-20250514",
      timeout = 30000,
      extra_request_body = {
        temperature = 0.75,
        max_tokens = 20480,
      },
    },
  },
})

Step 3: Open Neovim and Start Coding

1

Open a Code File

Open any code file in Neovim:
nvim your_file.py
2

Trigger Avante

There are several ways to interact with Avante:Option 1: Use the Command
:AvanteAsk
Option 2: Use the Default KeybindingPress <Leader>aa to show the Avante sidebar.
The default <Leader> key in Neovim is \, but many users remap it to , or <Space>.
3

Ask the AI a Question

Once the sidebar opens, you can ask questions about your code:
  • “Explain this function”
  • “Refactor this code to be more efficient”
  • “Add error handling to this function”
  • “Write unit tests for this code”
Type your question in the input area and press <CR> (Enter) in normal mode or <C-s> in insert mode to submit.
4

Review and Apply Changes

The AI will respond with suggestions in the sidebar. You can:
  • Apply all changes: Press A in the sidebar
  • Apply at cursor: Press a in the sidebar
  • Retry the request: Press r
  • Edit your request: Press e

Step 4: Explore Key Features

Add Files to Context

You can add specific files to the AI’s context:
  • Press @ in the sidebar to add a file
  • Press d to remove a file
  • Use <Leader>ac to add the current buffer
  • Use <Leader>aB to add all open buffers

Use Mentions and Commands

Type @ in the input to access mentions:
  • @codebase - Enable project context
  • @diagnostics - Include diagnostics information
  • @file - Open file selector
  • @buffers - Add open buffers
Type / for slash commands:
  • /help - Show help message
  • /clear - Clear chat history
  • /new - Start a new chat
  • /commit - Generate commit message

Visual Mode Selection

You can select code in visual mode and ask questions about it:
  1. Enter visual mode (v or V)
  2. Select the code you want to ask about
  3. Press <Leader>aa to open Avante with the selected code

Common Workflows

Example 1: Refactoring Code

def calculate(a, b, op):
    if op == '+':
        return a + b
    elif op == '-':
        return a - b
    elif op == '*':
        return a * b
    elif op == '/':
        return a / b
  1. Open the file in Neovim
  2. Press <Leader>aa
  3. Ask: “Refactor this function to use a dictionary for operations and add error handling”
  4. Review the AI’s suggestion
  5. Press A to apply all changes

Example 2: Writing Tests

  1. Select a function in visual mode
  2. Press <Leader>aa
  3. Ask: “Write unit tests for this function covering edge cases”
  4. Review the generated tests
  5. Apply the changes

Example 3: Understanding Code

  1. Navigate to an unfamiliar function
  2. Press <Leader>aa
  3. Ask: “Explain what this function does and its time complexity”
  4. Read the AI’s explanation in the sidebar

Tips for Success

Be specific in your requests. Instead of “fix this”, try “add error handling for network failures and validate input parameters”.
Use the avante.md file in your project root to provide project-specific context and coding standards to the AI.
Always review AI-generated code before applying it. The AI is a powerful assistant, but you should verify that changes meet your requirements and coding standards.

Keyboard Shortcuts Reference

Here are the most common keyboard shortcuts:
Key BindingDescription
<Leader>aaShow/toggle sidebar
<Leader>arRefresh sidebar
<Leader>afSwitch sidebar focus
A (in sidebar)Apply all changes
a (in sidebar)Apply change at cursor
r (in sidebar)Retry request
e (in sidebar)Edit request
q (in sidebar)Close sidebar
@ (in sidebar)Add file to context
d (in sidebar)Remove file from context

Next Steps

Congratulations! You’ve completed your first AI-assisted coding session with Avante.nvim. Here’s what to explore next:

Troubleshooting

If you encounter issues:
  1. Run :checkhealth avante to diagnose problems
  2. Check that your API key is set correctly
  3. Verify your Neovim version is 0.10.1 or later
  4. Review the GitHub issues for known problems
For more help, join the Discord community or check the documentation.

Build docs developers (and LLMs) love