CodeBuddy CLI access

CodeBuddy CLI officially supports adding custom models through models.json, and supports using environment variables to reference API Keys. This article uses ShangHai Do’s OpenAI Chat Completions interface.

CLI means a client operated through commands in a terminal. If not yet installed, follow CodeBuddy CLI installation guide to install the client.

configuration file location

Project-level configuration takes precedence over user-level configuration. Windows users can create the .codebuddy folder in the user directory; if the current version provides a configuration directory command, the path displayed on the client shall prevail.

Recommended configuration

{
  "models": [
    {
      "id": "qwen3.8-flash",
      "name": "ShangHai Do qwen3.8-flash",
      "vendor": "ShanHai",
      "apiKey": "${SHANHAI_API_KEY}",
      "url": "https://shanghaido.com/v1/chat/completions",
      "supportsToolCall": true,
      "supportsImages": false
    }
  ],
  "availableModels": ["qwen3.8-flash"]
}

CodeBuddy CLI official description: Custom models apiKey and url support ${环境变量名} expansion. First set the environment variables:

Windows PowerShell:

$env:SHANHAI_API_KEY = "YOUR_API_KEY"
codebuddy --model qwen3.8-flash

macOS / Linux:

export SHANHAI_API_KEY="YOUR_API_KEY"
codebuddy --model qwen3.8-flash

url Usually write the complete:

https://shanghaido.com/v1/chat/completions

This is different from most editors that “fill in the Base URL to /v1”. Do not change the full interface address to just /v1 unless the current CodeBuddy CLI version is explicitly configured to use another protocol such as api: "openai-responses".

Capability field

Usage and troubleshooting

CodeBuddy CLI supports automatic reloading after configuration file changes. Run the general Q&A first, then the small code tasks.

official information

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, error time and error information to facilitate troubleshooting.