Skip to main content
OpenAI provides powerful language models including GPT-4o and advanced reasoning models like o1 and o3-mini. Avante.nvim supports both the Chat Completions API and the newer Response API.

Quick Start

1

Get your API key

Sign up at OpenAI Platform and create an API key.
2

Set environment variable

Add to your shell configuration:
3

Configure provider

Configuration

Basic Configuration

Available Models

Response API

OpenAI’s Response API provides enhanced conversation management with stateful interactions. Avante automatically uses it for compatible models.

Automatic Detection

Features

  • Stateful conversations: Previous interactions tracked via previous_response_id
  • Encrypted reasoning: Reasoning content is encrypted for privacy
  • Function calling: Enhanced tool use with better state management

Environment Variables

Reasoning Models

Configuration

Reasoning models (o1, o3-mini) have special requirements:

Reasoning Effort Levels

Response API Format

When using Response API with reasoning models:

Azure OpenAI

Configuration

Environment Variables

API Version

Azure uses specific API versions. Current recommended version:

Advanced Configuration

Custom Endpoint

OpenRouter

Use OpenAI-compatible providers like OpenRouter:

Proxy Configuration

Parameter Compatibility

Chat Completions API vs Response API

Avante automatically converts parameters based on the API in use.

Tool Calling

Standard Format

Response API Format

With Response API, tools use a flattened structure:
Avante handles the conversion automatically.

Troubleshooting

Ensure your API key is set:
Restart Neovim after setting the variable.
OpenAI has different rate limits per tier:
  1. Check your limits at OpenAI Platform
  2. Increase timeout: timeout = 60000
  3. Consider upgrading your tier
Reasoning models take longer:
Ensure the deployment name matches your Azure resource:

Best Practices

Model Selection

  • GPT-4o: Best for general use
  • GPT-4o-mini: Cost-effective option
  • o1/o3-mini: Complex reasoning tasks

Token Management

  • Set max_completion_tokens appropriately
  • Reasoning models need more tokens
  • Monitor usage in OpenAI dashboard

Timeouts

  • Standard models: 30s
  • Reasoning models: 60-120s
  • Adjust based on complexity

Temperature

  • 0.0-0.3: Focused, deterministic
  • 0.4-0.7: Balanced (recommended)
  • 0.8-1.0: Creative
  • Reasoning models: Always 1.0

Example Configurations