Skip to main content

Aider

Aider is an open-source AI programming assistant that runs in the terminal. It supports multi-file editing and Git integration, and can directly modify local codebases through natural language conversation.

Prerequisites

  • You have activated a TCB environment and obtained the environment ID cloudBaseEnvID.

  • Enable the required model in the AI console.

  • Obtain the Base URL and API Key in the AI console.

Configuration Steps

Aider supports configuring custom models through environment variables or command-line parameters. CloudBase AI is compatible with the OpenAI protocol and can be accessed by using the openai prefix.

Configuration Field Mapping Table

Environment VariableDescription
OPENAI_API_BASEThe Base URL for the large model, which is obtained in the AI console.
OPENAI_API_KEYThe API Key for calling the large model, which is obtained in the AI console.

Method 1: Environment Variable Configuration

  1. Set the environment variables.

Mac/Linux (valid for the current terminal window)

export OPENAI_API_BASE="https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase"
export OPENAI_API_KEY="eyJhbGciOiJSUzI1N..."

Windows CMD (valid for the current terminal window)

set OPENAI_API_BASE=https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase
set OPENAI_API_KEY=eyJhbGciOiJSUzI1N...

Windows PowerShell (valid for the current terminal window)

$env:OPENAI_API_BASE = "https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase"
$env:OPENAI_API_KEY = "eyJhbGciOiJSUzI1N..."
  1. Start up Aider and specify the model ID using the --model parameter.
aider --model openai/hy3-preview
note

The model ID must be prefixed with openai/ to indicate invocation via the OpenAI-compatible protocol. The large model ID is obtained from the model list in the AI console.

Method 2: Command-Line Parameter Configuration

If you prefer not to set environment variables, you can also start it directly via command-line parameters:

aider --model openai/hy3-preview \
--openai-api-base "https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase" \
--openai-api-key "eyJhbGciOiJSUzI1N..."

Method 3: Configuration File, Permanent Effect

  1. Create the .aider.conf.yml file in the project root directory or the user home directory.
  • Project-level configuration (effective only for the current project)
<project_root>/.aider.conf.yml
  • User-level configuration (globally effective)
~/.aider.conf.yml
  1. Write the following configuration.
openai-api-base: https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase
openai-api-key: eyJhbGciOiJSUzI1N...
model: openai/hy3-preview
  1. After that, you can directly run aider in the terminal to use the configured model.
aider