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 URLandAPI Keyin 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 Variable | Description |
|---|---|
| OPENAI_API_BASE | The Base URL for the large model, which is obtained in the AI console. |
| OPENAI_API_KEY | The API Key for calling the large model, which is obtained in the AI console. |
Method 1: Environment Variable Configuration
- 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..."
- Start up Aider and specify the model ID using the
--modelparameter.
aider --model openai/hy3-preview
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
- Create the
.aider.conf.ymlfile 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
- Write the following configuration.
openai-api-base: https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase
openai-api-key: eyJhbGciOiJSUzI1N...
model: openai/hy3-preview
- After that, you can directly run
aiderin the terminal to use the configured model.
aider