Prerequisites
You must have either copilot.lua or copilot.vim installed and authenticated before using this provider.
Quick Start
Authenticate with GitHub Copilot
Follow the authentication flow in your Copilot plugin (usually
:Copilot setup or similar).Configuration
Basic Configuration
Available Models
Copilot provides access to various models. You can list available models:Authentication
OAuth Token Location
Copilot authentication is stored in:- copilot.lua:
~/.config/github-copilot/hosts.json - copilot.vim:
~/.config/github-copilot/apps.json
Token Refresh
Tokens are automatically refreshed:- Refreshed 2 minutes before expiration
- Background refresh every 28 minutes
- Stored in
~/.local/share/nvim/avante/github-copilot.json
Manual Refresh
If you need to re-authenticate:- Re-authenticate with your Copilot plugin
- Restart Neovim
- Avante will automatically pick up the new token
Response API
Copilot supports OpenAI’s Response API for certain models:Response API Features
- Encrypted reasoning: Reasoning content is encrypted
- Function calling: Enhanced tool use
- Full history: Copilot doesn’t support
previous_response_id, always sends full conversation
Unlike OpenAI’s Response API, Copilot requires sending the full conversation history with each request.
Model Listing
List available Copilot models:id: Model identifierdisplay_name: Human-readable namename: Full model name with providertokenizer: Tokenizer usedmax_input_tokens: Maximum input sizemax_output_tokens: Maximum output sizeversion: Model version
Advanced Configuration
Custom Endpoint
Proxy Configuration
Request Headers
Copilot uses specific headers for authentication:Troubleshooting
Authentication Failed
Authentication Failed
If Copilot authentication fails:
-
Verify Copilot plugin is installed:
-
Re-authenticate with Copilot:
-
Check OAuth token exists:
Token Expired
Token Expired
Tokens are auto-refreshed, but if you see expiration errors:
- Restart Neovim to trigger token refresh
- Re-authenticate with Copilot if needed
- Check token file:
~/.local/share/nvim/avante/github-copilot.json
Model Not Found
Model Not Found
If a model isn’t available:
-
List available models:
- Ensure you’re using a valid model ID
- Check your Copilot subscription includes the model
Copilot Plugin Not Detected
Copilot Plugin Not Detected
Error: “You must setup copilot with either copilot.lua or copilot.vim”
- Install copilot.lua or copilot.vim
- Authenticate with the plugin first
- Restart Neovim
Limitations
Best Practices
Subscription
- Requires active Copilot subscription
- Individual or Business plans supported
- Check limits in GitHub settings
Model Selection
- Default models work well
- Codex models for code-focused tasks
- List models to see what’s available
Token Management
- Tokens auto-refresh every 28 min
- Check
vim.g.avante_loginfor status - Re-auth if problems persist
Integration
- Works alongside Copilot plugin
- Shares authentication
- Independent model selection