Connect Trae CLI
Overview
Trae CLI is a terminal AI coding agent from ByteDance (GitHub) that supports code editing, file manipulation, and Bash operations from the command line. Through the trae_config.yaml configuration file, you can use Wuliang Open AI as the model backend to access a wide range of large language models.
Prerequisites
- macOS or Linux system
- An API Key created on the Wuliang Open AI platform
Configuration Steps
1. Install Trae CLI
macOS / Linux
bash
sh -c "$(curl -L https://trae.cn/trae-cli/install.sh)" && export PATH=~/.local/bin:$PATHWindows PowerShell
powershell
irm https://trae.cn/trae-cli/install.ps1 | iexVerify the installation:
bash
trae-cli --version2. Create the Configuration File
Run the following commands to create the configuration file in your user directory:
bash
mkdir -p ~/.local/share/trae-cli
touch ~/.local/share/trae-cli/trae_config.yaml3. Edit trae_config.yaml
Open ~/.local/share/trae-cli/trae_config.yaml and add the following content. Replace your-api-key with your Wuliang Open AI API Key:
yaml
model_providers:
wuliang:
api_key: your-api-key
provider: openai
base_url: https://open.dieyuyun.com/v1
models:
trae_agent_model:
model_provider: wuliang
model: gpt-5.5
max_tokens: 4096
temperature: 0.5
top_p: 1
top_k: 0
max_retries: 10
parallel_tool_calls: true
agents:
trae_agent:
model: trae_agent_model
max_steps: 200
tools:
- bash
- str_replace_based_edit_tool
- sequentialthinking
- task_done| Field | Description |
|---|---|
model_providers.wuliang.api_key | Your Wuliang Open AI API Key |
model_providers.wuliang.provider | Must be openai (OpenAI-compatible protocol) |
model_providers.wuliang.base_url | Wuliang Open AI API endpoint |
models.trae_agent_model.model | Model code, e.g. gpt-5.5. See Models & Pricing for all available models |
models.trae_agent_model.model_provider | Must match the name defined in model_providers |
agents.trae_agent.model | References the model defined in models |
WARNING
Tabs are not allowed in YAML files. Make sure to use spaces for indentation only.
4. Launch Trae CLI
bash
# Run a single task
trae-cli run "Create a hello world Python script"
# Enter interactive mode
trae-cli interactive
# View current configuration
trae-cli show-configAPI Endpoint Reference
Wuliang Open AI OpenAI-compatible endpoint details:
| Field | Value |
|---|---|
| Base URL | https://open.dieyuyun.com/v1 |
| Auth Header | Authorization: Bearer your-api-key |
| Format | JSON |
Example request:
bash
curl --request POST 'https://open.dieyuyun.com/v1/chat/completions' \
--header 'Authorization: Bearer your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Introduce yourself."}
],
"temperature": 0.7,
"max_tokens": 1024
}'Notes
- Model Codes: The
modelfield must exactly match the codes listed on the Models & Pricing page. - Config File Path: The configuration file is located at
~/.local/share/trae-cli/trae_config.yamlby default. Runtrae-cli show-configto view the active configuration. - MCP Tools: Trae CLI supports MCP (Model Context Protocol) tool extensions, which can be added in the
mcp_serverssection of the configuration file.
Related Docs
- Manage API Keys - Create and configure API Keys
- Models & Pricing - Browse available models and pricing
- API Reference - View the full API documentation