CodeBuddy Code
CodeBuddy Code is a terminal AI programming tool (CLI) developed by Tencent Cloud CodeBuddy. It supports AI-powered conversations, code generation, file operations, and terminal command execution via the command line.
Prerequisites
- You have activated a TCB environment and obtained the environment ID
cloudBaseEnvID - Enable the required model in the AI console
- Obtain the
Base URLandAPI Keyin the AI console
Configuration Steps
CodeBuddy Code manages custom models through a models.json configuration file.
Configuration field reference
| Field | Description |
|---|---|
| id | Model ID, copy the enabled model identifier from the AI Console model list |
| name | Display name for the model |
| url | Model Base URL, obtained from the AI Console |
| apiKey | API Key for calling the model, obtained from the AI Console |
- User-level Config (Global)
- Project-level Config (Current Project)
- Open or create the CodeBuddy Code configuration file
If browsing for the file, your file browser may hide files starting with ".". You may need to enable showing hidden files.
On Mac, use Finder shortcut Command + Shift + .. On Windows, check "File Explorer - View - Show - Hidden items".
- Mac/Linux path
~/.codebuddy/models.json
- Windows path
C:\Users\<your-username>\.codebuddy\models.json
- Add the following configuration
{
"models": [
{
"id": "hy3-preview",
"name": "hy3-preview (CloudBase)",
"vendor": "CloudBase",
"url": "https://{{cloudBase-env-ID}}.api.tcloudbasegateway.com/v1/ai/cloudbase",
"apiKey": "eyJhbGciOiJSUzI1N...",
"maxInputTokens": 128000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": true
}
],
"availableModels": ["hy3-preview"]
}
- Start CodeBuddy Code
codebuddy --model hy3-preview
Or switch models during interaction with the /model command.
Create .codebuddy/models.json in your project root. The format is the same as user-level config. Project-level config takes priority over user-level and overrides models with the same ID.
<project-root>/.codebuddy/models.json
The configuration content is the same as user-level config. CodeBuddy Code automatically reads project-level config on startup.
Troubleshooting
| Error | Solution |
|---|---|
| Request failed / connection timeout | Verify the Base URL in the url field is correct |
401 authentication failed | API Key is incorrect or expired, please obtain a new one from the AI Console |
429 Token usage exceeded quota limit | Model name is incorrect, or the model is not enabled in the AI Console |
| Model not visible in list | Check that the availableModels array includes the model ID |