Skip to content
Discussion options

You must be logged in to vote
codecompanion-nvim = {
            enable = true;
            setupOpts.adapters = lib.generators.mkLuaInline ''
              {
               openrouter_claude = function()
                 return require("codecompanion.adapters").extend("openai_compatible", { env = { url = "https://openrouter.ai/api", api_key = "OPENROUTER_API_KEY", chat_url = "/v1/chat/completions", }, schema = { model = { default = "anthropic/claude-4-sonnet", }, }, })
               end
              }
            '';
            setupOpts.strategies.chat.adapter = "openrouter_claude";
          };

sorry, adapters has kind of a weird type, this should work

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@matt-carty
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by matt-carty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants