Skip to content

Re-list and update avante.nvim docs #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/about/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Major features and changes are noted here. To review all updates, see the

Related: [Upgrade CodeGate](../how-to/install.md#upgrade-codegate)

- **New integration: Open Interpreter** - 20 Feb, 2025\
CodeGate v0.1.24 adds support for the
[avante.nvim](https://github.com/yetone/avante.nvim) plugin for Neovim with
OpenAI and CodeGate muxing. See the
[integration guide](../integrations/avante.mdx) to get started.

- **Muxing filter rules** - 18 Feb, 2025\
CodeGate v0.1.23 adds filter rules for model muxing, allowing you to define
which model should be used for a given file type. See the
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ AI coding assistants / IDEs:

- **[Aider](./integrations/aider.mdx)** with Ollama and OpenAI-compatible APIs

- **[avante.nvim](./integrations/avante.mdx)** (Neovim plugin) with OpenAI

- **[Cline](./integrations/cline.mdx)** in Visual Studio Code

CodeGate supports Ollama, Anthropic, OpenAI and compatible APIs, OpenRouter,
Expand Down
139 changes: 92 additions & 47 deletions docs/integrations/avante.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,123 @@ title: Use CodeGate with avante.nvim
description: Configure the `avante.nvim` plugin for Neovim
sidebar_label: avante.nvim
sidebar_position: 15
unlisted: true
---

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

**[avante.nvim](https://github.com/yetone/avante.nvim)** is a Neovim plugin that
provides a Cursor-like user experience. It integrates with multiple AI providers
(e.g. Claude and OpenAI).
provides a Cursor-like user experience with multiple AI providers.

CodeGate works with [OpenAI](https://openai.com/api/) and compatible APIs
through Avante.

You can also use [CodeGate muxing](../features/muxing.mdx) to select your
provider and model using [workspaces](../features/workspaces.mdx).

## Install avante.nvim

Install the **avante.nvim** plugin using your preferred plugin manager. For
instructions, consult **avante.nvim**'s
Install the `avante.nvim` plugin using your preferred Neovim plugin manager. For
detailed installation instructions, refer to Avante's
[documentation](https://github.com/yetone/avante.nvim?tab=readme-ov-file#installation).

## Configure CodeGate with avante.nvim
:::tip

You can also install [codegate.nvim](https://github.com/stacklok/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](https://lazy.folke.io/) (recommended), configure the
`avante.nvim` provider settings as shown:

<Tabs groupId="provider" queryString="provider">
<TabItem value="mux" label="CodeGate muxing" default>
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.

Consult **avante.nvim**'s documentation for specific examples on customizing
your configuration using your preferred plugin manager.
Then configure `avante.nvim` to use the CodeGate mux endpoint:

Using `lazy.nvim` (recommended) add the following configuration to enable
CodeGate with **avante.nvim**:
```lua title="~/.config/nvim/lua/plugins/avante.lua"
{
"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 ...
}
```

</TabItem>
<TabItem value="openai" label="OpenAI">
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.

```lua
```lua title="~/.config/nvim/lua/plugins/avante.lua"
{
"yetone/avante.nvim",
-- ... etc ...
opts = {
-- your provider configuration ...
provider = "openai",
openai = {
endpoint = "http://localhost:8989/openai", -- use the endpoint matching your LLM provider
model = "gpt-4o", -- your desired model (or use gpt-4o, etc.)
timeout = 30000, -- timeout in milliseconds
temperature = 0, -- adjust if needed
max_tokens = 4096,
},
"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 ...
},
-- ... etc ...
}
```

</TabItem>
</Tabs>

:::note

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

:::

### Verifying configuration
## Verify configuration

To verify the configuration, type `:AvanteChat` to start the **avante.nvim**
plugin. You should see the **avante.nvim** UI appear in the Neovim window.
To verify your setup:

Type and send the following message:
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](http://localhost:9090).

```
codegate version
```
:::info Known issue

If CodeGate is configured correctly, you should see a response from the CodeGate
server.
`codegate` commands like `codegate version` are not currently working with
avante.nvim. We are
[tracking this issue here](https://github.com/stacklok/codegate/issues/1061).

### Model muxing
:::

To take advantage of CodeGate's [model muxing feature](../features/muxing.mdx),
use **avante.nvim**'s OpenAI provider with the following configuration:
## Next steps

```lua
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,
},
```
Learn more about [CodeGate's features](../features/index.mdx) and explore the
[dashboard](../how-to/dashboard.md).