Fix CodeCompanion adapter: use openai -> OpenRouter
This commit is contained in:
@@ -1,24 +1,21 @@
|
|||||||
return {
|
return {
|
||||||
"olimorris/codecompanion.nvim",
|
"olimorris/codecompanion.nvim",
|
||||||
dependencies = {
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
},
|
|
||||||
config = function()
|
config = function()
|
||||||
require("codecompanion").setup({
|
local openai = require("codecompanion.adapters").extend("openai", {
|
||||||
adapters = {
|
|
||||||
openrouter = function()
|
|
||||||
return require("codecompanion.adapters").extend("openai", {
|
|
||||||
env = {
|
env = {
|
||||||
url = "https://openrouter.ai/api/v1",
|
|
||||||
api_key = "OPENROUTER_API_KEY",
|
api_key = "OPENROUTER_API_KEY",
|
||||||
|
url = "https://openrouter.ai/api/v1",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
|
||||||
|
require("codecompanion").setup({
|
||||||
|
adapters = {
|
||||||
|
openai = openai,
|
||||||
},
|
},
|
||||||
strategies = {
|
strategies = {
|
||||||
chat = { adapter = "openrouter" },
|
chat = { adapter = "openai" },
|
||||||
inline = { adapter = "openrouter" },
|
inline = { adapter = "openai" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user