Skip to content

Latest commit

 

History

History
125 lines (96 loc) · 3.67 KB

avante.mdx

File metadata and controls

125 lines (96 loc) · 3.67 KB
title description sidebar_label sidebar_position
Use CodeGate with avante.nvim
Configure the `avante.nvim` plugin for Neovim
avante.nvim
15

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

avante.nvim is a Neovim plugin that provides a Cursor-like user experience with multiple AI providers.

CodeGate works with OpenAI and compatible APIs through Avante.

You can also use CodeGate muxing to select your provider and model using workspaces.

Install avante.nvim

Install the avante.nvim plugin using your preferred Neovim plugin manager. For detailed installation instructions, refer to Avante's documentation.

:::tip

You can also install codegate.nvim, a plugin that interfaces with CodeGate and allows you to quickly switch between workspaces without leaving Neovim.

:::

Configure avante.nvim to use CodeGate

Configure avante.nvim to route requests through CodeGate by setting its provider endpoint to http://localhost:8989/<provider>.

Using lazy.nvim (recommended), configure the avante.nvim provider settings as shown:

First, configure your [provider(s)](../features/muxing.mdx#add-a-provider) and select a model for each of your [workspace(s)](../features/workspaces.mdx#manage-workspaces) in the CodeGate dashboard.

Then configure avante.nvim to use the CodeGate mux endpoint:

{
  "yetone/avante.nvim",
  -- ... etc ...
  opts = {
    provider = "openai",
    openai = {
      endpoint = "http://localhost:8989/v1/mux", -- CodeGate's mux endpoint
      model = "gpt-4o", -- the actual model is determined by your CodeGate workspace
      timeout = 30000, -- timeout in milliseconds
      temperature = 0, -- adjust if needed
      max_tokens = 4096,
    },
  },
  -- ... etc ...
}
You need an [OpenAI API](https://openai.com/api/) account to use this provider. To use a different OpenAI-compatible endpoint, set the `CODEGATE_OPENAI_URL` [configuration parameter](../how-to/configure.md) when you launch CodeGate.
{
  "yetone/avante.nvim",
  -- ... etc ...
  opts = {
    provider = "openai",
    openai = {
      endpoint = "http://localhost:8989/openai", -- CodeGate's OpenAI endpoint
      model = "gpt-4o", -- your desired model
      timeout = 30000, -- timeout in milliseconds
      temperature = 0, -- adjust if needed
      max_tokens = 4096,
    },
  },
  -- ... etc ...
}

:::note

avante.nvim does not yet support fill-in-the-middle (FIM) completions. You have to configure your FIM completion plugin separately.

:::

Verify configuration

To verify your setup:

  1. In Neovim, type :AvanteChat to launch the Avante interface.
  2. Enter the following prompt in the chat:
    add a variable AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
    
  3. The response should indicate that CodeGate redacted the secret, and an alert is logged in the dashboard.

:::info Known issue

codegate commands like codegate version are not currently working with avante.nvim. We are tracking this issue here.

:::

Next steps

Learn more about CodeGate's features and explore the dashboard.