Adds a custom CodeCompanion adapter for GitHub Copilot Business/Enterprise plans.
- A GitHub Copilot Business/Enterprise plan for your organization,
- codecompanion.nvim, and
- one of the following plugins, setup for an enterprise account:
- copilot.vim, look for the
g:copilot_enterprise_uriglobal option; - copilot.lua, look for the config option
auth_provider_url.
- copilot.vim, look for the
Use your favourite package manager.
lazy.nvim
Install as a dependency of olimorris/codecompanion.nvim.
{
"olimorris/codecompanion.nvim",
dependencies = {
"dyamon/codecompanion-copilot-enterprise.nvim"
-- other plugins...
}
}If your organization is available at https://acme.ghe.com
require("codecompanion").setup({
adapters = {
http = {
copilot_enterprise = function()
local adapter = require 'codecompanion.adapters.http.copilot_enterprise'
adapter.opts.provider_url = "acme.ghe.com" -- 'https://' can be removed but doesn't hurt.
return adapter
end,
},
},
strategies = {
chat = {
-- Setup the custom adapter for each strategy. You can change default models as usual.
-- See https://codecompanion.olimorris.dev/configuration/adapters.html#changing-the-default-adapter
-- and https://codecompanion.olimorris.dev/configuration/adapters.html#changing-a-model
adapter = {
name = "copilot_enterprise",
model = "claude-sonnet-4",
},
},
inline = {
adapter = "copilot_enterprise",
},
cmd = {
adapter = "copilot_enterprise",
},
},
})- Copilot statistics: it seems like the same API endpoint used for individual GitHub accounts to get statistics about Copilot usage is available for enterprise accounts as well, but returns a whooping 404; I can replicate this behaviour in VS Code as well. If the feature becomes available in the future, the plugin supports it already.
- Oli Morris for creating CodeCompanion.nvim.
MIT