Configuring ACP Adapters
This section contains configuration which is specific to Agent Client Protocol (ACP) adapters only. There is a lot of shared functionality between ACP and http adapters. Therefore it's recommended you read the two pages together.
Setup: Auggie CLI from Augment Code
To use Auggie CLI within CodeCompanion, you simply need to follow their Getting Started guide.
Setup: Cagent
To use Docker's Cagent within CodeCompanion, you need to follow these steps:
- Install Cagent as per their instructions
- Create an agent in the repository you're working from
- Test the agent by running
cagent run your_agent.yamlin the CLI - In your CodeCompanion config, extend the
cagentadapter to include the agent:
require("codecompanion").setup({
adapters = {
acp = {
cagent = function()
return require("codecompanion.adapters").extend("cagent", {
commands = {
default = {
"cagent",
"acp",
"your_agent.yaml",
},
},
})
end,
},
},
})If you have multiple agent files that you like to run separately, you can create multiple commands for each agent.
Setup: Claude Code
To use Claude Code within CodeCompanion, you'll need to take the following steps:
Using Claude Pro Subscription
- In your CLI, run
claude setup-token. You'll be redirected to the Claude.ai website for authorization: - Back in your CLI, copy the OAuth token (in yellow):
- In your CodeCompanion config, extend the
claude_codeadapter and include the OAuth token (see the section on environment variables and setting API keys for other ways to do this):
require("codecompanion").setup({
adapters = {
acp = {
claude_code = function()
return require("codecompanion.adapters").extend("claude_code", {
env = {
CLAUDE_CODE_OAUTH_TOKEN = "my-oauth-token",
},
})
end,
},
},
})Using an API Key
- Create an API key in your Anthropic console.
- In your CodeCompanion config, extend the
claude_codeadapter and set theANTHROPIC_API_KEY:
require("codecompanion").setup({
adapters = {
acp = {
claude_code = function()
return require("codecompanion.adapters").extend("claude_code", {
env = {
ANTHROPIC_API_KEY = "my-api-key",
},
})
end,
},
},
})Setup: Codex
To use OpenAI's Codex, install an ACP-compatible adapter like this one from Zed.
By default, the adapter will look for an OPENAI_API_KEY in your shell, however you can also authenticate via ChatGPT. This can be customized in the plugin configuration:
require("codecompanion").setup({
adapters = {
acp = {
codex = function()
return require("codecompanion.adapters").extend("codex", {
defaults = {
auth_method = "openai-api-key", -- "openai-api-key"|"codex-api-key"|"chatgpt"
},
env = {
OPENAI_API_KEY = "my-api-key",
},
})
end,
},
},
})Setup: Gemini CLI
- Install Gemini CLI
- Update your CodeCompanion config and select which authentication methods you'd like to use. Currently there are:
oauth-personalwhich uses your Google logingemini-api-keyvertex-ai)
The example below uses the gemini-api-key method, pulling the API key from 1Password CLI:
require("codecompanion").setup({
adapters = {
acp = {
gemini_cli = function()
return require("codecompanion.adapters").extend("gemini_cli", {
defaults = {
auth_method = "gemini-api-key", -- "oauth-personal"|"gemini-api-key"|"vertex-ai"
},
env = {
GEMINI_API_KEY = "cmd:op read op://personal/Gemini_API/credential --no-newline",
},
})
end,
},
},
})Setup: Goose CLI
To use Goose in CodeCompanion, ensure you've followed their documentation to setup and install Goose CLI. Then ensure that in your chat buffer you select the goose adapter.
Setup: Kimi CLI
Install Kimi CLI as per their instructions. Then in the CLI, run kimi followed by /setup to configure your API key. Then ensure that in your chat buffer you select the kimi_cli adapter.
Setup: opencode
To use opencode in CodeCompanion, ensure you've followed their documentation to install and configure it. Then ensure that in your chat buffer you select the opencode adapter.