Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/yetone/avante.nvim/llms.txt

Use this file to discover all available pages before exploring further.

Claude is Anthropic’s family of AI models, known for their advanced reasoning capabilities and extended thinking modes. Avante.nvim supports both API key authentication and Claude Pro/Max subscription authentication.

Quick Start

API Key Authentication

1

Get your API key

Sign up at Anthropic Console and create an API key.
2

Set environment variable

Add to your shell configuration:
# Scoped (recommended)
export AVANTE_ANTHROPIC_API_KEY=your-api-key

# Or global
export ANTHROPIC_API_KEY=your-api-key
3

Configure provider

{
  "yetone/avante.nvim",
  opts = {
    provider = "claude",
  },
}

Claude Pro/Max Subscription

If you have a Claude Pro or Max subscription, you can authenticate using OAuth:
1

Enable OAuth authentication

{
  "yetone/avante.nvim",
  opts = {
    provider = "claude",
    providers = {
      claude = {
        auth_type = "max", -- Use "max" for subscription auth
      },
    },
  },
}
2

Authenticate in browser

When you open Neovim, the authentication process will start in your browser.
3

Enter authorization code

Copy the code shown in your browser and paste it into the Neovim prompt.
If you previously had a different provider selected, run :AvanteSwitchProvider claude to initiate authentication.

Configuration

Basic Configuration

providers = {
  claude = {
    endpoint = "https://api.anthropic.com",
    model = "claude-sonnet-4-5-20250929",
    timeout = 30000,
    context_window = 200000,
    extra_request_body = {
      temperature = 0.75,
      max_tokens = 64000,
    },
  },
}

Available Models

providers = {
  claude = {
    model = "claude-sonnet-4-5-20250929",
    extra_request_body = {
      max_tokens = 64000,
    },
  },
}

Authentication Types

providers = {
  claude = {
    auth_type = "api",
  },
}

Environment Variables

Claude uses the following environment variables:
VariableScoped VersionPurpose
ANTHROPIC_API_KEYAVANTE_ANTHROPIC_API_KEYAPI authentication
When using auth_type = "max", API keys are not required as OAuth is used instead.

Advanced Features

Prompt Caching

Claude supports prompt caching to reduce costs and latency for repeated prompts:
providers = {
  claude = {
    -- Prompt caching is enabled by default
    support_prompt_caching = true,
  },
}
Avante automatically applies caching to:
  • System prompts
  • Tool definitions
  • The last text message in history

Extended Thinking

Claude models support extended thinking for complex reasoning tasks. This is automatically enabled when the model returns thinking content.
-- Thinking is displayed with <think> tags in the output
-- Example:
-- <think>
-- Let me analyze this code structure...
-- </think>
-- 
-- Here's the solution:

Custom Endpoint

For self-hosted or proxy setups:
providers = {
  claude = {
    endpoint = "https://your-custom-endpoint.com",
  },
}

Proxy Configuration

providers = {
  claude = {
    proxy = "http://proxy.example.com:8080",
    allow_insecure = false,
  },
}

Rate Limiting

Claude automatically handles rate limiting by:
  1. Detecting rate limit headers
  2. Calculating sleep time based on reset timestamps
  3. Pausing requests until limits reset
You can monitor rate limits in the response headers:
  • anthropic-ratelimit-tokens-remaining
  • anthropic-ratelimit-tokens-reset
  • anthropic-ratelimit-requests-reset

Troubleshooting

Authentication Failed

Ensure your API key is set in your environment:
echo $ANTHROPIC_API_KEY
# or
echo $AVANTE_ANTHROPIC_API_KEY
Restart Neovim after setting the variable.
If the OAuth code doesn’t work:
  1. Ensure you copied the entire code from the browser
  2. Try the authentication flow again
  3. Check that auth_type = "max" is set correctly
OAuth tokens are automatically refreshed. If you see expiration errors:
  1. Wait a moment for auto-refresh
  2. Restart Neovim to trigger re-authentication

Quota Exceeded

If you see quota errors:
insufficient_quota: You don't have any credits or have exceeded your quota
Check your usage at Anthropic Console and add credits or upgrade your plan.

Temperature Errors

Claude requires temperature between 0 and 1:
extra_request_body = {
  temperature = 0.75, -- Must be 0.0 to 1.0
}

Best Practices

Model Selection

  • Sonnet 4.5: Best balance of speed and capability
  • Opus 4: Maximum capability for complex tasks
  • Haiku 3.5: Fastest, best for simple tasks

Token Management

  • Use prompt caching for repeated contexts
  • Set appropriate max_tokens limits
  • Monitor usage in Anthropic Console

Temperature Settings

  • 0.0-0.3: Focused, deterministic responses
  • 0.4-0.7: Balanced creativity and consistency
  • 0.8-1.0: More creative and varied responses

OAuth vs API Key

  • OAuth: For Claude Pro/Max subscribers
  • API Key: For pay-per-use developers
  • Both work with same models

Example Configurations

{
  provider = "claude",
  providers = {
    claude = {
      model = "claude-sonnet-4-5-20250929",
      timeout = 30000,
      extra_request_body = {
        temperature = 0.7,
        max_tokens = 32000,
      },
    },
  },
}

Build docs developers (and LLMs) love