Skip to content

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:$PATH

Windows PowerShell

powershell
irm https://trae.cn/trae-cli/install.ps1 | iex

Verify the installation:

bash
trae-cli --version

2. 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.yaml

3. 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
FieldDescription
model_providers.wuliang.api_keyYour Wuliang Open AI API Key
model_providers.wuliang.providerMust be openai (OpenAI-compatible protocol)
model_providers.wuliang.base_urlWuliang Open AI API endpoint
models.trae_agent_model.modelModel code, e.g. gpt-5.5. See Models & Pricing for all available models
models.trae_agent_model.model_providerMust match the name defined in model_providers
agents.trae_agent.modelReferences 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-config

API Endpoint Reference

Wuliang Open AI OpenAI-compatible endpoint details:

FieldValue
Base URLhttps://open.dieyuyun.com/v1
Auth HeaderAuthorization: Bearer your-api-key
FormatJSON

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 model field 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.yaml by default. Run trae-cli show-config to view the active configuration.
  • MCP Tools: Trae CLI supports MCP (Model Context Protocol) tool extensions, which can be added in the mcp_servers section of the configuration file.