Casually/dsh-trae-api
Project Overview项目介绍
This repository is a native DeepSeek Harness (DSH) plugin that can also be run as a standalone service. Its core function is to expose existing Trae IDE credits as a local API service compatible with OpenAI and Anthropic’s interface standards. This allows popular third-party AI coding agents including Claude Code, Cursor, Cline, and Windsurf to directly call underlying models hosted by Trae, including GLM, DeepSeek, Qwen, Kimi, and MiniMax. It supports all four current versions of Trae: Trae CN, TRAE SOLO CN, Trae SG, and TRAE SOLO SG, and automatically decrypts authentication tokens stored in local Trae files.
Before installation, users must first install and log into a supported version of Trae IDE on their local machine. There are two installation paths available: the recommended method is to install it as a DSH plugin, which only requires running dsh plugin --profile web add @casually/dsh-trae-api and restarting DSH to automatically activate the proxy. The alternative is to run it standalone by cloning the repo, installing dependencies with npm install, and launching it with the included start script. On first run, it automatically extracts and decrypts Trae authentication data and saves it to a local .env file. It is built for developers who already have Trae credits and want to use Trae’s models in third-party AI coding tools.
This project requires Node.js 18 or newer, and is released under the open source MIT license. By default, the service only listens on 127.0.0.1, which blocks access from external networks. If you need to open access to devices on the local area network, you must change the host setting and set a strong custom API key to prevent unauthorized use. CORS restrictions only allow cross-origin requests from localhost, which prevents third-party web pages from misusing your Trae credits. The tool is for educational and research use only, and users are responsible for any costs or compliance issues that arise from use.
本项目是 DeepSeek Harness(DSH)原生插件,也可独立运行,作用是将 Trae IDE 的积分额度转化为本地兼容 OpenAI/Anthropic 标准的 API 服务,让 Claude Code、Cursor、Cline、Windsurf 等第三方 AI 编程工具直接调用 Trae 底层模型。它支持 Trae CN、TRAE SOLO CN、Trae 国际版、TRAE SOLO 国际版四个版本,可自动从本地 Trae 存储文件中解密认证 Token。
用户需先在本机安装并登录对应版本的 Trae IDE,之后可选择两种部署方式:作为 DSH 插件安装时,执行 dsh plugin --profile web add @casually/dsh-trae-api 后重启 DSH 即可自动启动代理服务;也可拉取源码后独立运行,首次启动会自动解密 Trae 认证数据并保存。它适合已有 Trae 可用积分,想在第三方 AI 编程工具中调用 Trae 底层模型的开发者使用。
本项目要求 Node.js 版本不低于 18,采用 MIT 许可证开源。使用时默认监听 127.0.0.1,仅允许本地访问,如需开放局域网需自行修改配置并设置强 API Key。工具仅作学习研究使用,使用产生的费用与合规问题由用户自行承担,需遵守 Trae 平台的使用条款。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-trae-api(Casually/dsh-trae-api)
仓库:https://github.com/Casually/dsh-trae-api
本站详情页:https://www.yhbd.top/plugins/casually-dsh-trae-api/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 2 · 最近提交 2026-08-27 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add @casually/dsh-trae-api
把 Casually/dsh-trae-api 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
原项目:https://github.com/Wang-JQ77/dsh-trae-api
dsh-trae-api (Trae Local API)
将 Trae Work CN 的积分/额度转化为本地 OpenAI/Anthropic 兼容 API 服务,让 Claude Code、Cursor、Cline、Windsurf 等第三方 AI 编程工具直接调用 Trae 底层模型(GLM、DeepSeek、Qwen、Kimi、MiniMax 等)。
本项目是一个 DeepSeek Harness (DSH) 插件(npm 包名 @casually/dsh-trae-api),安装后随 dsh 启动自动运行代理服务;也可以独立运行。
npm 上的无 scope 包名
dsh-trae-api归原项目作者所有;本 fork 以@casually/dsh-trae-api发布。
v1.1.0 新增:DSH Web 设置页面(设置 → Trae API 代理)——实时状态、请求统计、Token 管理(刷新/重新解密)、上游连通性测试、配置热更新(保存即生效,无需重启 DSH)。
原理
- 本机已安装并登录 Trae Work CN(或 TRAE SOLO CN / Trae SG / TRAE SOLO)
- 脚本自动从本地
storage.json中解密认证 Token(支持 tc 加密和明文两种格式) - 启动一个本地 Express 服务器,提供 OpenAI/Anthropic 兼容的 API 端点
- 第三方 Agent 将请求发送到本地服务器,本地服务器转发到 Trae 上游 API
- 消耗的是 Trae 的积分,无需额外付费
支持的 Trae 版本
| 版本 | IDE 名称 | 加密格式 | 上游端点 |
|---|---|---|---|
cn |
Trae CN 国内版 | tc 加密 | trae-api-cn.mchost.guru |
solo |
TRAE SOLO CN 独立部署版 | tc 加密 | trae-api-cn.mchost.guru |
sg |
Trae 国际版 | 明文 JSON | a0ai-api-sg.byteintlapi.com |
solo-sg |
TRAE SOLO 国际版 | tc 加密 | a0ai-api-sg.byteintlapi.com |
功能
- 自动解密四版本认证数据,无需手动配置 Token
- 提供 OpenAI (
/v1/chat/completions) 和 Anthropic (/v1/messages) 兼容接口 - 支持 OpenAI Responses API (
/v1/responses),兼容新版 OpenAI SDK 和 Agents SDK - Token 过期自动刷新,自动保存到
.env - 支持流式输出 (SSE)
- 完整支持 Claude Code 工具调用
- 3 级 API 端点回退机制
- 自适应 CN/SG 两种 SSE 事件格式
- 上下文窗口自动截断,避免超出 Token 限制
- DSH 设置页面(v1.1.0+):
- 运行状态一览(监听地址、版本、上游、用户、Token/Refresh 过期倒计时)
- 请求统计(各端点请求数、错误数、运行时长)
- 一键刷新 Token / 重新解密凭证 / 测试上游连接
- 端口、监听地址、API Key、版本、上游地址、上下文上限在线修改,保存后代理热重启立即生效
前置条件
- Node.js >= 18(内置
fetch支持) - 已安装并登录以下任一 Trae IDE:
- Trae CN(国内版)
- TRAE SOLO CN(独立部署版)
- Trae(国际版)
- TRAE SOLO(国际版)
- 对应 IDE 的
%APPDATA%目录下存在globalStorage/storage.json
快速开始
方式 A:作为 DSH 插件安装(推荐)
前提:已安装 DeepSeek Harness(dsh CLI)。
# 安装到 web profile
dsh plugin --profile web add @casually/dsh-trae-api
# 重启 dsh 使插件生效
dsh web
插件启动后,代理服务自动运行在 http://localhost:9220。可通过插件配置自定义端口和 API Key:
# 编辑 profile 的 cordis.patch.yml
- insert:
- id: trae-api
name: '@casually/dsh-trae-api'
config:
port: 9220
apiKey: ***
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
mafeis/dsh-net-proxy
esengine/DeepSeek-Reasonix
strukto-ai/mirage