All integrations

CLI Tools

TraeCode CLI

Configure a model in global YAML after an administrator enables custom models.

LimitedOpenAI Chat CompletionsDocs checked

Configuration is available with version, account, region or feature restrictions. Read the conditions below first.

On this page

Before you begin

This guide follows the China edition’s TraeCode CLI documentation. Confirm that your tenant and version allow custom models.

Have an A2Agent API key ready and copy an accessible model ID from the catalog. Replace every placeholder, back up existing settings and keep keys out of repositories.

Setup

File contents are usually shared; switching OS changes commands and paths. For WSL on Windows, select macOS / Linux.

  1. 01Install and check access

    Install using the official CLI guide, confirm administrator approval for custom models, then run traecli config edit.

    Open official documentation
    Shell
    traecli config edit
  2. 02Merge the YAML

    Merge models into the global trae_cli.yaml opened by the command. Preserve other fields, save, then launch and select A2Agent with /model.

    yaml
    models:
      - name: A2Agent
        open_ai:
          base_url: "https://a2agent.me/v1"
          api_key: "YOUR_A2AGENT_API_KEY"
          model: "YOUR_MODEL_ID"
          by_azure: false

Capabilities and limits

  • User configuration cannot bypass a tenant restriction.
  • The key is plaintext; keep it in user-level configuration. This guide does not verify the international edition’s entry points.

Verify the connection

Replace every placeholder and run locally. Expect JSON containing OK. Then start a new client conversation, test one read-only tool call separately, and confirm the requests in A2Agent usage records. This test incurs a small amount of model usage.

Shell
curl --fail-with-body --silent --show-error --max-time 60 'https://a2agent.me/v1/chat/completions' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_A2AGENT_API_KEY' \
  -d '{"model":"YOUR_MODEL_ID","max_tokens":128,"messages":[{"role":"user","content":"Reply with OK."}]}'

Troubleshooting

If custom models are missing, check administrator policy first. For YAML errors, check indentation and avoid tabs.

401 / 403: authentication or access denied

Use a key issued by A2Agent, without extra spaces, and check that it is active and unexpired. Confirm the group permits the model and protocol. A vendor subscription credential cannot replace an A2Agent key.

404 / model not found: endpoint or model mismatch

Check the root URL, /v1 prefix and full request path against this guide; avoid duplicated paths. Model IDs are case-sensitive and must be accessible to the current key.

429: quota or rate limit

Check your balance, key limits, concurrent usage and service status. Wait before retrying and reduce simultaneous agents; repeated retries do not remove a quota limit.

Chat works, but tools fail or streaming stops

Test a short text request, then a single read-file tool call. Check tool support, output budget, proxy timeouts and client version. Inspect the diff before resuming a long task to avoid repeating actions.

Restore previous settings

Use traecli config edit to remove the added model and restore the previous model selection.

Sources and check date

Status is based on official configuration docs, not end-to-end client testing with A2Agent.

Docs checked 2026-09-18