跳到主内容

treg 使用指南

为 DSH agent 接入 treg 工具市场:提供约 2600 个外部 API 端点的访问能力,密钥在服务端注入,调用方无需持有凭证。

本文为派生内容(基于 wiki / faq / compatibility_json 自动组装),非 AI 即时创作。

本文由本站基于该插件已收录的字段自动派生(wiki / faq / compatibility_json / readme),非 AI 即时创作。每节末尾标源字段。

快速上手

treg

— 源: plugin_wiki.wiki_content

安装与验证

dsh plugin --profile web add github:superdesigndev/treg

复制以上命令在 DSH Web Profile 内运行。安装完成后在「插件列表」启用即可。

— 源: plugins.install

关键要点

  • The catalog — external endpoints treg can serve on its own key, metered against your
  • Your own tools — anything a teammate registered: a paid API account, an OAuth connection, a
  • tool = something the registry calls for you with the org's credential. Two kinds:
    • endpoint — an upstream base_url + credential bindings (each binding injects one
    • CLI — a vendor binary (stripe, gh, vercel, ...) run with the credential injected.

— 源: plugin_wiki.readme_zh (fallback readme_raw)

常见问题

没有 TREG_TOKEN 时会发生什么?

MCP 连接器行(treg-mcp)会自动禁用,5 个 mcp__treg__* 工具不会出现在 agent 里,但 SKILL.md 仍会加载并引导用户去 treg.to 注册获取 token。

在哪里获取 TREG_TOKEN?

在 https://treg.to 通过 GitHub / Google / 邮箱验证码登录后从账户页复制,新团队有 $1.00 免费额度。

需要为每个第三方 API 单独注册账号并申请 key 吗?

不需要。treg 用自己的 key 调上游并按调用从团队预付余额扣费,团队里其他人注册过的 key 也会优先使用且不计量。

调用方会拿到第三方 API 的 key 吗?

不会。treg 代理是"忠实转发":只改 hop-by-hop header、自己的控制 header 和注入的凭证,其他字节(含 key)原样转发,X-Treg-Token 在到达上游前被剥离。

遇到 HTTP 402 怎么办?

表示团队预付余额不足。调用方应查 mcp__treg__balance / treg balance 并提示用户去 https://treg.to 充值,或让团队为该 provider 注册自己的 key。

为什么 ~/.agents/skills/treg/ 下面会重复出现一份 SKILL.md?

treg 的 install.sh 会跑 treg skill bootstrap 把 SKILL.md 写到 ~/.agents/skills/treg/,和本 bundle 自带的版本重复,但内容相同、无害。

如何从 dsh 中彻底卸载?

从 dsh profile 的插件列表中移除 treg-dsh 这条 bundle 即可,不需要再清理环境变量(TREG_TOKEN 是 treg 服务自己的,不是 dsh 的)。

第三方 API 升级了 treg 需要跟着改吗?

不需要。treg 代理不解析上游 body、不缓存模型,原样转发请求和响应,所以上游 API 变动对 treg 透明。

— 源: plugin_wiki.faq_json

兼容性

  • DSH: 未声明
  • Node: 未声明

— 源: plugin_wiki.compatibility_json

踩坑提醒

安装前请审阅上游仓库;本指南基于已收录字段自动派生,可能滞后于最新版本。如发现与官方文档冲突,请以上游为准。

— 来源:通用规则