Preface¶
When developing agents in DeepSeek Harness (DSH), model sources typically come from self-built APIs or third-party OpenAI-compatible gateways. If you have already installed and logged into the Trae desktop App (Chinese or International version) on your local machine, your account actually possesses available remote session capabilities and a model catalog. However, these interfaces are not in OpenAI format, and DSH cannot directly read the desktop application’s login state.
The dsh-trae-connect (maintained by marsma-101) described below achieves this by: locally decrypting credentials stored by Trae, translating the Trae remote session protocol into a small OpenAI-compatible HTTP gateway on loopback, and registering two groups, Trae (Chinese version) and Trae Intl (International version), in the DSH model selector. Once installed, it requires minimal configuration, as it automatically discovers installation paths and data directories. This project is intended for personal learning and research only; please comply with Trae’s Terms of Service. The protocol implementation references the public documentation of Trae2api-cn, which is MIT licensed.
What is this¶
dsh-trae-connect is a DSH community plugin (Category: Model Inference), currently at version 0.1.0 with an MIT license. It does not replicate Trae’s account system but reuses your already logged-in desktop App. It reads product.json to determine the Chinese/International version and the actual upstream mirror, decrypts the Cloud-IDE-JWT from storage.json, fetches the model list online, and registers adapters with provider IDs trae and trae-intl via ctx.llm.registerAdapter.
Core Features¶
Automatic Discovery of Trae Installation and Data Directories¶
The plugin scans candidate paths based on the platform: Windows reads the InstallLocation from the uninstall registry (finding non-default drives as well); macOS checks /Applications; Linux checks two XDG base directories, and WSL additionally tries /mnt/<drive> mappings. Upon hitting a match, it reads resources/app/product.json, distinguishes versions using packageType (TRAE_CN / TRAE_I18N), and uses bootConfig.remote.trae to obtain the actual upstream for that account (the International version selects mirrors like normal, SG, US based on the region, rather than hardcoding a hostname).
For data directories, under candidate roots like %APPDATA% / %LOCALAPPDATA%, it first tries known directory names, then applies a loose scan for directories containing trae, attempting to decrypt User\globalStorage\storage.json one by one. It takes the first directory that yields a valid token for both the Chinese and International versions; if both are installed, both groups will appear. Explicit paths take priority: the settings card allows filling in the data directory or the full path to storage.json for the Chinese/International versions, or using environment variables TRAE_DATA_DIR_CN / TRAE_DATA_DIR_INTL.
If no credentials are found after scanning, the log will prompt to confirm that Trae has been started and logged into (the App needs to remain running during the model list fetch and path scanning; initial use requires completing login within Trae first).
Dynamic Model Catalog and Display¶
The model list is fetched in real-time from Trae online (/models?functions=<bucket selected by version>&show_custom_model=true), refreshed every 10 minutes; if it fails, it falls back to an internal list. The bucket for the Chinese version is solo_agent_remote; for the International version, it is solo_agent (full catalog, consistent with the Trae International UI). Model names may be annotated with credit multipliers (e.g., · x0.8); the International version marks models locked for unpaid tiers with · 🔒 Unlocked, based on access.enable === true in features. Custom models configured by the user in Trae will not appear in the selector.
The settings card also provides: “Use upstream declared maximum context window” toggle (default on, max-mode uses 1M window); Thinking intensity level (determined by reasoning.enable and reasoning_effort_config.options); “Ephemeral” (delete temporary remote sessions on the Trae side after each conversation turn, default on).
Credentials, Gateway, and Protocol Translation¶
Credentials are decrypted from iCubeAuthInfo://icube.cloudide using the “tc” envelope algorithm (AES-128-CBC + SHA-512 derived key). Copies are stored in <DSH_HOME>\.trae-connect\credentials.json (Chinese version) and credentials-intl.json (International version) with 0600 permissions. The Cloud-IDE-JWT is automatically refreshed via ExchangeToken 30 minutes before expiration.
An OpenAI-compatible service starts on a random port on local 127.0.0.1 (/v1/models, /v1/chat/completions). Each version (Chinese/International) holds a unique Bearer token and performs Host/Origin loopback validation. OpenAI requests are translated into POST /api/remote/v1/chat_sessions and SSE event streams; the Chinese version sends a single header Authorization: Cloud-IDE-JWT with Origin solo.trae.cn; the International version sends both Cloud-IDE-JWT and Authorization: Cloud-IDE-JWT headers, with Origin work.trae.ai.
Comparison of Chinese and International Versions¶
| Group | provider id | Typical Data Path (Windows) | Upstream (Example) |
|---|---|---|---|
| Trae (Chinese) | trae |
%APPDATA%\Trae CN\User\globalStorage\storage.json |
https://trae-api-cn.mchost.guru/api/remote/v1 (Verified Working) |
| Trae Intl | trae-intl |
%APPDATA%\Trae\User\globalStorage\storage.json |
Selects mirror based on region from installed product.json; can be overridden in settings card “International Upstream Address” |
The model list response format for the International version differs from the Chinese version (data.list[].models); the plugin parser supports both. Selecting a locked model will result in an upstream session creation rejection, and the plugin error will note that a Trae paid tier upgrade is required.
Installation and Activation¶
Neither the captured README nor the SkillHub catalog page provides a fixed dsh plugin add … command line for installation. For installation methods, please refer to the plugin installation instructions for your current DSH version and the “Installable” entry on the catalog page; source code and cordis.patch.yml are available in the GitHub repository.
Please note before enabling: The plugin runs with the permissions of the current DSH process user. It will read the Trae data directory and write credential copies under <DSH_HOME>\.trae-connect\. You should review the source code and MIT license yourself before installation to confirm you accept behaviors such as decrypting local login states and accessing Trae private remote interfaces.
Typical Usage¶
The README does not provide standalone CLI examples; the expected workflow is as follows:
- Install the Trae desktop App on your local machine (Chinese and/or International version), complete login, and keep the App running.
- Install and enable dsh-trae-connect in DSH.
- In the DSH model selector, choose a model under the Trae or Trae Intl group and use it for standard model conversations.
- If auto-discovery fails, fill in the data directory in the plugin settings card or set
TRAE_DATA_DIR_CN/TRAE_DATA_DIR_INTL; for International credit queries, you must manually fill in “International Credit API Root Address” (the official credit domain is marked as unverified in the materials).
Use Cases and Limitations¶
Suitable for: Personal developers who already use the Trae desktop App and wish to reuse the same account model catalog and login state in DSH agent workflows; scenarios requiring coexistence of Chinese and International version groups and model lists that update with Trae online without modifying the plugin.
Limitations (Explicitly stated in README):
- Tool calling (function calling) is not implemented; only text/reasoning conversations are supported.
- Relies on Trae client private interfaces; the plugin may require adjustments after major Trae version updates.
- The International version credit API domain is unverified; the status card credit function requires manually filling in the root address to enable.
Disclaimer: This project is not affiliated with Trae, ByteDance, or DeepSeek; consequences of use are borne by the user; do not use for commercial purposes.
Links¶
- Community Catalog: https://www.skillhub.cn/plugins/marsma-101/dsh-trae-connect
- Source Code & Docs: https://github.com/marsma-101/dsh-trae-connect
The DSH ecosystem emphasizes “Everything is a Plugin”; SkillHub is an independent community directory and has no official affiliation with DeepSeek / High-Flyer.