Skip to main content

CodeBuddy Code Configuration Documentation

Overview

This document explains how to configure CodeBuddy Code using CloudBase AI CLI.

Cloudbase AI CLI Introduction

CloudBase AI CLI supports configuring CodeBuddy Code in two ways:

  • CodeBuddy account login: Log in using a CodeBuddy account, supporting OAuth authentication.
  • API key configuration: Log in using a CodeBuddy API key

CodeBuddy Configuration

Run:

tcb ai --setup

After running the command, you will go to the configuration wizard.

  1. Select the AI programming assistant to be configured, and select CodeBuddy Code
  2. Choose the configuration method, and choose Log in using a CodeBuddy account
  3. Follow the prompts to log in to your CodeBuddy account
  4. Finally, select the default AI programming assistant to use. It will be opened by default when you run tcb ai in the future.

Launching CodeBuddy Code

tcb ai -a codebuddy
tip

If CodeBuddy Code is configured as the default, you can directly run tcb ai.

Detailed Configuration Instructions

Custom Configuration

Configuring the CodeBuddy API Key

  • API Key: Enter your CodeBuddy API Key

Environment Variable Configuration

CodeBuddy Code supports configuration via environment variables:

export CODEBUDDY_API_KEY="your-api-key-here"

MCP Server Configuration

CodeBuddy Code supports MCP command management through parameter pass-through:

# Parameter Pass-through via CloudBase AI CLI
tcb ai -a codebuddy -- --mcp-server "your-mcp-server-config"

Configuration Validation

The configuration of CodeBuddy Code is automatically validated, including:

  • API Key Format Validation
  • Network connectivity test
  • MCP Server Configuration Check

Troubleshooting

Frequently Asked Questions

  1. API Key Invalid

    • Check if the API Key is correct
    • Verify if the API Key has sufficient usage permissions
    • Check the CodeBuddy account status
  2. Network Connection Issues

    • Check firewall settings
    • Verify that the network can access the CodeBuddy service
    • Try changing the network environment
  3. MCP Server Configuration Error

    • Verify MCP server configuration format
    • Check if the server address is accessible
    • Verify server authentication credentials

View Logs

Enable verbose logging to troubleshoot issues:

tcb ai -a codebuddy -- --verbose

Best Practices

  1. API Key Security Management

    • Use environment variables instead of hardcoding API keys
    • Rotate API keys regularly
    • Restrict the permission scope of API keys
  2. MCP Server Management

    • Use configuration files to manage multiple MCP servers
    • Check server status regularly
    • Back up important server configurations
  3. Performance Optimization

    • Select an appropriate model based on the project scale
    • Configure the number of concurrent requests appropriately
    • Monitor API usage and cost