Use CodeCompanion.nvim with Shannon
Extend CodeCompanion's openai_compatible adapter with Shannon's URL and key, and its chat buffer, inline edits and @{agent} tools use Shannon models.
- From the CodeCompanion.nvim docs, Nov 7, 2026
- OpenAI Chat Completions
- About 4 min
About CodeCompanion.nvim
CodeCompanion.nvim is a Neovim plugin for chatting with models in a buffer, editing code inline and running agents: with tool groups such as @{agent} the model reads and edits files and runs commands while you approve each step. Its openai_compatible adapter takes a URL, a key and a name, so it can run on Shannon models.
What you need
- A Shannon API key
- Keys & usage
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Every snippet below follows your choice.
Set it up
-
Export your key
The adapter's
api_keynames the environment variable, so the key never sits in your config.Shellexport SHANNON_API_KEY=YOUR_API_KEY -
Add the Shannon adapter
Extend
openai_compatibleunderadapters.http.urlis the host without/v1; the defaultchat_urlandmodels_endpointadd/v1/chat/completionsand/v1/models. Make it the adapter for chat, inline, cmd and background tasks.init.luarequire("codecompanion").setup({ adapters = { http = { shannon = function() return require("codecompanion.adapters").extend("openai_compatible", { formatted_name = "Shannon", env = { url = "https://api.shannon-ai.com", api_key = "SHANNON_API_KEY", }, schema = { model = { default = "Kimi-K3-uncensored-NVFP4", choices = { ["Kimi-K3-uncensored-NVFP4"] = { meta = { context_window = 1022976 } }, }, }, }, opts = { vision = true }, }) end, }, }, interactions = { chat = { adapter = "shannon" }, inline = { adapter = "shannon" }, cmd = { adapter = "shannon" }, background = { adapter = "shannon" }, }, }) -
Open a chat
Run
:CodeCompanionChat. Add@{agent}to a message to let the model read, edit and run commands, approving each tool call.
Check that it works
Send: @{files} Create cat.py with a function that returns "meow".
You should see: CodeCompanion asks you to approve create_file, then cat.py exists.
Models that fit CodeCompanion.nvim
Every id below meets what CodeCompanion.nvim needs. The first one is the default in the snippets.
| Model id | Context window | Max output | Image input |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | Yes |
shannon-coder-1 | 131,072 | 65,536 | No |
Kimi-K3.1-Pro-uncensored-NVFP4 | 1,022,976 | 262,144 | Yes |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | Yes |
shannon-3 | 196,608 | 65,536 | Yes |
Model settings
CodeCompanion.nvim asks for these values. They follow the model you picked.
| Setting | Value | Why |
|---|---|---|
meta.context_window | 1022976 | The model's window; compaction and editing triggers need it. |
Good to know
- Without
api_key, the adapter sendsOPENAI_API_KEY. Set it so no other key goes to Shannon. - The background adapter defaults to Copilot. Set
interactions.backgroundtoo, or chat titles and the tool judge fail without telling you. - Tools and images are on by default for
openai_compatible; setopts.vision = falsefor models that do not read images. - For the Responses API, extend
openaiinstead, withurl = "https://api.shannon-ai.com/v1/responses".
Tips
- Press
gdin the chat buffer to open the debug window and see exactly what goes to Shannon on the next turn. - Give each model
meta.context_windowunderchoices; compaction at 85% of the window is skipped without it. - Leave out
choicesto have CodeCompanion list every Shannon id from/v1/models; the list is cached for 30 minutes. @{agent}is CodeCompanion's agent mode with its own system prompt;@{files}gives the model file tools only.- Press
gain a chat to change adapter or model without leaving the conversation.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| 404 Not Found | env.url includes /v1, so the path is doubled. | Use url = "https://api.shannon-ai.com". |
| 401 Unauthorized | SHANNON_API_KEY is not set in Neovim's environment, so another key or none is sent. | Export it in your shell profile and restart Neovim. |
401 Unauthorized | The key is missing, mistyped or rotated. | Copy the key again from Keys & usage; it starts with sk-. |
context_length_exceeded / "prompt is too long" | The conversation is longer than the model's window. | Start a new chat, let the tool compact it, or pick a model with a larger window. |
insufficient_quota | Your balance cannot pay for the request. | Top up or change plan; the request is not retried by itself. |
Questions
Does CodeCompanion.nvim work with Shannon?
Yes, through an adapter that extends openai_compatible with env.url = "https://api.shannon-ai.com".
Can I add several Shannon models?
Yes: list them under schema.model.choices, or leave choices out to load the whole list, and switch with ga.