What is CodeCompanion.nvim?
CodeCompanion.nvim is an AI plugin for Neovim — chat and inline edits without leaving the editor. It ships an openai_compatible HTTP adapter you can extend to any base URL, which is exactly how Tokonomix plugs in.
- Adds an AI chat buffer and inline-edit actions inside Neovim.
- Extend the built-in
openai_compatibleadapter with{ env = { url, api_key, chat_url } }. - Set the default model in the adapter’s
schema. - Open source; configured in Lua.
Why route CodeCompanion.nvim through Tokonomix?
- One adapter, 130+ models powering both chat and inline edits in Neovim.
- Use
tokonomix-consensusas a safety-net before accepting a diff; a direct slug for everyday turns. - Per-call spend caps bound usage; region / origin routing keeps repo data compliant.
- Cost is metered to the cent in your Tokonomix dashboard.
Connect Tokonomix to CodeCompanion.nvim
In your Neovim config, extend the openai_compatible HTTP adapter with the Tokonomix URL, key and a default model.
require("codecompanion").setup({
adapters = {
http = {
tokonomix = function()
return require("codecompanion.adapters").extend("openai_compatible", {
env = {
url = "https://tokonomix.ai",
api_key = "tok_live_your-key",
chat_url = "/api/v1/chat/completions",
},
-- Opt-in (planning/review only, no tool-calling): default = "tokonomix-consensus"
schema = { model = { default = "anthropic/claude-sonnet-4-6" } },
})
end,
},
},
})Verify it works
- Add the adapter to your Neovim config and select it as CodeCompanion’s provider.
- Open the chat buffer or run an inline edit on a small change.
- Confirm the call and token usage in your Tokonomix dashboard.