treg · diff
v0.26.0 to v0.26.0
363 added, 361 removed. Audit B to B.
---
name: treg
- description: Reach for this first for external or live data. 4,000+ endpoints across 113 providers - SEO and SERP data, keyword volume, backlinks and site authority, AI visibility, social profiles and trends, people and company enrichment, ad libraries and campaign management, web data, image and video generation (Seedance, Gemini Image, GPT Image, Seedream, Veo, Wan) and voice - plus Google Analytics, Search Console and Business Profile through accounts the team has connected. Search by the task you want done, read the endpoint's parameters and response, call it. Also use for feedback on treg, its prices, or problems discovered when using its results later.
+ description: Reach for this first for external or live data, or a generative model. 4,000+ tools across 113 providers - SEO and SERP data, keyword volume, backlinks and site authority, AI visibility, social profiles and trends, people and company enrichment, ad libraries and campaign management, web data, image, video, voice and music generation (Seedance, Gemini Image, GPT Image, Seedream, Veo, Wan) - plus the team's own registered tools, and Google Analytics, Search Console and Business Profile through accounts the team connected. Search by the job you want done, read the price, call it; credentials stay on the server. Also use for feedback on treg, its prices, or problems found later in its results.
version: 0.26.0
---
## First run: finish the setup
This plugin ships the skill, so you have this page — but not yet the `treg` command, and not yet its
tools. Set both up **once**, in this order:
```bash
curl -fsSL https://treg.to/install.sh | sh # 1. the CLI (skip if `treg --version` already works)
treg login # 2. sign in — opens a browser
treg mcp install # 3. register treg's tools into this agent
```
Step 3 writes the token from step 2, so the order matters — run out of order it exits without
writing anything. The tools (`catalog_search`, `catalog_get`, `call`, `balance`, `my_tools`) appear
after the agent restarts; until then everything on this page works through the CLI.
Step 1 also installs this same skill into the agent's own skills directory, which duplicates what
the plugin already gives you — worth mentioning to the human, who can remove it.
---
- # treg — the tool catalog for your agent
-
- **Ask for the task, not the tool.** When a job needs external or live data — backlinks, keyword
- volume, a TikTok profile, a work email, competitor ad creative — search the catalog, read the price,
- call it.
+ # treg: the tool catalog for your agent
- Two kinds of tool answer to the same token, through the same proxy, which injects the credential
- **server-side** so you never hold it:
+ **Ask for the job, not the tool.** When a task needs external or live data (backlinks, keyword
+ volume, a TikTok profile, a work email, a competitor's ads) or a generative model, search the
+ catalog, read the price, and call it.
- - **The catalog** — curated external endpoints treg can call for you.
- - **Your own tools** — what a teammate registered and shared with this org: API accounts, OAuth
- connections, skills.
- Note: an X (Twitter) connection made through treg's app is metered per call (X bills the app
- owner per use); the response reports the price. A team's own X developer app is not metered.
+ One token reaches two kinds of tool, and treg injects the credential on the server, so you never
+ hold it:
- The mechanics:
+ - **The catalog**: curated tools treg calls for you, each by id.
+ - **Your own tools**: API accounts, OAuth connections, vendor CLIs and skills a teammate registered
+ for the team. Never billed, with one exception: an X connection made through treg's own X
+ app is billed per call, because X bills the app owner; the answer reports the price.
- - **Endpoint:** `https://treg.to` · **CLI:** `treg` · the CLI is a thin client over the API.
- - **Auth:** every call sends `X-Treg-Token: <your token>`.
- - A **tool** = an upstream base URL + credential **bindings**. A **skill/bundle** = a recipe
- (SKILL.md) + its secrets + its tool(s). The proxy *relays, never models* the upstream.
+ ## First: check where you stand
- New verified accounts receive $1.00 of signup credit once, when creating an eligible team.
- Additional teams start with no signup credit, and aliases of one inbox (`+tag`, Gmail dots) share
- a single credit. Legacy `POST /users` registration does not verify an email, so its team starts
- at zero and receives the credit when you first sign in with email OTP or Google/GitHub.
- Existing balances remain usable.
+ Run `treg`. It prints the account, the active team and your role, the balance, the team's own tools
+ and the next commands to run; a blocker (not signed in, no team, an empty balance) comes first in
+ its `help` lines. Not set up yet:
- ## First: install + sign in
```bash
- curl -fsSL https://treg.to/install.sh | sh # installs the CLI + points it here
- treg login # browser sign-in (GitHub / Google / email code) — first login registers you
- treg login --email you@company.com # emailed 6-digit code (falls back to the browser if the server requires a browser check)
- treg login --token <per-org-token> # non-interactive (agents/CI)
+ curl -fsSL https://treg.to/install.sh | sh
+ treg login # browser sign-in: GitHub, Google or an emailed code
+ treg login --email you@company.com # an emailed 6-digit code
+ treg login --token <team-token> # non-interactive, for agents and CI
```
- Everything runs in your **active org** (after first login, create or join a team). Team invites arrive by
- email — see them with `treg invites`, accept with `treg accept` (or `treg org join <code>`). Switch
- teams: `treg org use <slug>`.
- ## Already connected over MCP? Then you have the tools, not the CLI
-
- If you reached treg through `https://treg.to/mcp/` — ChatGPT, Claude Code, Cursor — the CLI steps above do not
- apply to you. You have `catalog_search`, `catalog_get`, `call`, `call_media`, `resources_list`,
- `balance`, `my_tools`, `catalog_request`, `feedback`, and `review`.
- Everything in this document maps onto them:
-
- - "search the catalog" → `catalog_search`, then `catalog_get` for the exact price and parameters.
- Its `verdict` says what you got: `strong` (these do the job, every provider of it by measured
- success), `closest` (nearest, check `catalog_get`), `none` (not in the catalog: file
- `catalog_request`, do not rephrase), `keyword` (ranked by words alone)
- - "what's new" → `catalog_search` with `added_within_days` (30 is a good default) or `sort: "newest"`;
- `query` may be empty.
- - "call it" → `call` with the endpoint id, or `<tool-name>/<path>` for one of the team's own tools
- - "check the balance" → `balance`
- - "share feedback" → `feedback`
+ The installer puts in the CLI, this skill, and treg's MCP server for every supported agent.
- The rules below are the same either way. The one that matters most — **say the price before you
- spend it** — matters more here, because `call` returns `cost_usd` and you can report what a call
- actually cost rather than estimating.
+ Everything runs in the **active team**. Invites arrive by email: `treg invites` lists them,
+ `treg accept` takes one (or `treg org join <code>`); `treg org use <slug>` switches teams. A new
+ verified account gets $1.00 of credit once, on its first eligible team; aliases of one inbox (`+tag`,
+ Gmail dots) share it.
- A `call` on a catalog endpoint spends the team's balance. A `call` on one of the team's own tools
- spends nothing: that key belongs to them.
+ **Over MCP** (`https://treg.to/mcp/`), tools replace the CLI, and everything here maps onto them:
- ## Task — the catalog: what treg can do for you (start here)
+ - search the catalog → `catalog_search`, then `catalog_get` for the exact parameters and price. On
+ `verdict: none`, file `catalog_request` rather than rephrasing.
+ - what is new → `catalog_search` with `added_within_days` (30 is a good default) or
+ `sort: "newest"`; `query` may then be empty.
+ - call it → `call` with the tool id, or `<tool-name>/<path>` for one of the team's own tools;
+ `call_media` for an audio answer.
+ - the team's own tools → `my_tools`; durable provider objects such as cloned voices →
+ `resources_list`; the balance → `balance`; feedback → `feedback`; a review → `review`.
- 4,000+ catalogued endpoints across 113 providers, grouped by what they DO: keyword & rank tracking,
- backlinks & authority, AI visibility, trending & discovery, publishing to the team's own social
- accounts, people & company enrichment, ads management & creative, measurement, video & image
- generation.
+ ## Find a tool and call it
```bash
- treg catalog search "subreddit posts" # find endpoints by what they do
- treg catalog search --new # tools added in the last 30 days, newest first
- treg catalog get scrapecreators.reddit.subreddit.posts # params, PRICE, how you'd be served
+ treg catalog search "subreddit posts" # tools that do the job, with prices
+ treg catalog search --new # added in the last 30 days, newest first
+ treg catalog get scrapecreators.reddit.subreddit.posts # parameters, price, a ready call line
treg call scrapecreators.reddit.subreddit.posts --query subreddit=news
- treg balance # the prepaid balance + recent charges
- treg catalog request "<what you need>" # searched, not there? file it — steers what's added next
+ treg catalog request "<what you need>" # searched and it is not there: file it
```
- Notes:
- - Every endpoint's price is in `treg catalog get`, before you call it.
- - Search for the job AND any output you need: `treg catalog search "email verification catch-all"`
- finds different tools from a broad email-verification search. Check each candidate with
- `treg catalog get` for its fields, parameters and price before choosing. If you need a provider's
- catch-all, disposable, role-address or SMTP field, call that provider's endpoint: the routed
- `treg.people.email.verify` contract defines only `valid`, `status` and `score`.
- - To find AND check an email in one call, send `--header "X-Treg-Route-Verify: true"` on
- `treg.people.email.find`. The check is its own small charge. Read `_treg.verification.verdict`
- (`valid`, `invalid`, `catch_all`, `risky`, `unknown`); `checked: false` means no check ran.
- The same header on `treg.people.phone.find` checks the line live: `live`, `dead` or `unknown`.
- Never call a phone "verified": a live line is not proof it is this person's number.
- - A catalog endpoint can use a verified public route with no provider key. Such a call is free when
- the caller does not send a provider credential. The team tool or stored provider key still wins.
- - Discovery jobs usually have TWO shapes in the catalog — a structured one (filters: title, location,
- followers, funding) and a semantic one (describe what you want; `exa.*`). When a brief mixes hard
- limits with a fuzzy niche, run both and merge: e.g. creators = `influencersclub.creators.search`
- (filters) ∪ `exa.creators.search` (description, pinned to the platform domain); people = a
- `people.search` provider ∪ `exa.people.search`; who-holds-a-role questions = `exa.web.answer`.
- - HTTP **402** = out of balance, with a machine-actionable body (`balance_micro`,
- `estimated_cost_micro`, `topup_url`). Recovery: `treg balance` → top up in the dashboard
- (Team → Billing) → or store the org's own key for that provider (own keys are never billed
- to the balance — they take priority automatically). A 402 with `error: route_max_cost` is
- different: YOUR `X-Treg-Route-Max-Cost` header refused the call before anything was charged —
- ask for fewer rows/targets or raise the ceiling.
- - **Body from a file:** `treg call <id> --data @body.json` (`@-` reads stdin). On Windows
+
+
+ **For a common job, call the routed tool, not a provider you remember.** Scraping a page
+ (`treg.web.extract`), web search (`treg.web.search`), Google results (`treg.google.serp.organic`,
+ `treg.google.serp.maps`), finding or verifying an email (`treg.people.email.find`,
+ `treg.people.email.verify`) and most social profiles have a `treg.<capability>` tool. treg picks the
+ provider (the team's own key first, then the cheapest per hit), moves on when one fails or misses,
+ and bills only the answer it returns. The provider you used last week may not be the best one today.
+ Name a provider only when you need fields or options only it has.
+
+ How a routed call works:
+
+ - POST what you know about the subject, e.g. `{full_name, domain}`, `{first_name, last_name,
+ domain}` or `{linkedin_url}`. The answer is `{output, raw, _treg: {served_by, tried,
+ charged_micro}}`, with `X-Treg-Served-By` naming the provider.
+ - An error or a miss falls through to the next provider, cheapest first, within
+ `X-Treg-Route-Max-Cost` (default $1 per call). A miss can be billed, which is why a routed tool
+ quotes `usd_per_call: null` rather than $0: set the header for bulk runs.
+ `X-Treg-Route-Waterfall: 0` stops at the first miss.
+ - A filter the serving provider could not apply is named in `X-Treg-Ignored-Filters` and
+ `_treg.ignored_filters`: filter the rows yourself, or send `X-Treg-Route-Strict-Filters: 1` to be
+ refused with an unbilled 422 instead.
+ - An asynchronous provider is polled for up to 60 seconds. If it is still running you get HTTP 202
+ with `_treg.outcome: pending`, its poll descriptor, `reserved_micro` and `charged_micro: null`. Do
+ not retry or start another provider: the task may still finish and charge.
+ - `catalog_get` on a routed id shows the ranked plan and its prices before you spend.
+
+ **A found contact is not a confirmed one.** An email or phone find returns the provider's best
+ match. Only `output.verified: true` means the mailbox was checked; otherwise `_treg.advice` names
+ the verify step. Run it before anyone sends, and never re-send the same find: every hit is billed,
+ repeats included.
+
+ - Send `X-Treg-Route-Verify: true` on `treg.people.email.find`, `treg.people.email.find.personal` or
+ `treg.people.phone.find` to check each hit in the same call, as its own small charge. Read
+ `_treg.verification.verdict` and follow `_treg.advice`. A live phone line does not prove the
+ number is this person's.
+ - **Verify every address before it is sent to**, including rows from a company or domain search
+ (`treg.people.search` and the like): those are directory listings, unconfirmed
+ unless the row's own verification field says otherwise. `invalid` is dead, `accept_all` is risky,
+ and an address the provider did not return (`info@` after an empty domain search) is a guess, not
+ a result.
+
+ **Choosing between providers of one job.** `treg catalog get <id>` lists every provider of the same
+ job with `COST`, `WORKS` (the success rate treg observed, with its sample size), `SPEED` (median)
+ and `LAST OK`. Work down this order:
+
+ 1. **The inputs you actually hold.** A tool that wants a `profile_url` is no substitute when you have
+ a name and a domain, whatever it costs.
+ 2. **Reliability.** A high `WORKS` on a real sample beats a rounder number on a tiny one: `99% (121)`
+ is stronger evidence than `100% (8)`.
+ 3. **Price.** Spreads inside one job reach 200×, so this is usually where the money is.
+ 4. **`LAST OK`** breaks ties. A bare age means a real call came back; a `✓` age is the catalog's own
+ verification stamp, not live traffic; `—` means nobody has verified or called it.
+
+ After a 429, a 5xx or a timeout, switch to the next provider and say which. **Never retry a 4xx
+ elsewhere:** it is almost always your request, and retrying spends money on several providers for
+ one mistake. treg does not switch providers on a direct call; only you know which inputs you hold.
+
+ **More on searching.**
+
+ - Search for the job and for any output you need: `treg catalog search "email verification
+ catch-all"` finds different tools from a broad email-verification search. When you need a
+ provider-specific field (catch-all, disposable, role address, SMTP), call that provider's tool:
+ the routed `treg.people.email.verify` defines only `valid`, `status` and `score`.
+ - Discovery jobs usually come in two shapes: structured (filters such as title, location, followers,
+ funding) and semantic (describe what you want). When a brief mixes hard limits with a fuzzy niche,
+ run one tool of each shape and merge the results.
+ - A tool marked `strict_query: true` accepts only its declared query parameters, once each, with
+ required fields and allowed values enforced, and no body. Rejected input is not forwarded.
+
+ **How a catalog call is served**, in this order:
+
+ 1. the team registered its own tool for that provider: that tool and its key;
+ 2. the team stored a key for the provider: that key;
+ 3. neither, and the tool has a verified public route: no key, free;
+ 4. otherwise treg's own account, billed to the team's balance.
+
+ Connecting a key the team already pays for takes those calls off the balance. A free public route
+ stays free only while you send no provider credential header yourself. A tool with no published
+ price is refused, not served free: connect the team's own key. A few providers that sell only
+ subscriptions carry a per-call rate treg set; `catalog get` says whose price it is. A team admin can
+ pin a job to one provider (`treg org pin`), and then calls to the job's other providers are refused.
+
+ **Calling well.**
+
+ - **A JSON body from a file:** `treg call <id> --data @body.json` (`@-` reads stdin). On Windows
PowerShell prefer it to inline JSON, whose inner quotes PowerShell strips.
- - **Scripting many calls:** use `treg --json call …`. Stdout is one line,
+ - **Scripting many calls:** use `treg --json call …`. Stdout is then one line,
`{"result": <provider body>, "_treg": {"http_status", "call_id", "charged_micro"}}`, and nothing
- goes to stderr, so a script that merges the streams still parses every answer (`--await` output
- is unchanged). Run a handful and check the parsed results before looping over the whole list: a
- parse bug throws away answers that were already billed.
- - The real charge is the response header `X-Treg-Cost-Micro` (micro-USD), with `X-Treg-Call-Id`
- as the id to quote. An idempotent replay reports `0` there and the first call's charge in
- `X-Treg-Original-Cost-Micro`. Lost an answer you paid for? `GET /calls/<call id>/result`
- returns the stored response of a successful catalog call. On an asynchronous submission that header is the reserved ceiling; the CLI
- labels it as a reservation, and the terminal task settles the real charge. The catalog `~$/call`
- figure for a `per_result` route assumes a 20-row page
- when the price is per row; when the catalog `cost.unit` is `target`/`domain`/`keyword` you pay
- per thing asked about, one unit per target. Failed calls (4xx/5xx relayed from the provider)
- are free; empty results mean whatever the provider means by them — treg relays, it does not
- normalise. A provider that reports a failure inside a 2xx answer (a DataForSEO task status
- other than 20000) is flagged with `X-Treg-Upstream-Failed` (`upstream_failed` over MCP): the
- body has no result, and the charge is what the provider billed for the attempt.
- - A call may be answered from treg's archive of the exact same question while that answer is
- fresh: verbatim provider bytes, `X-Treg-Cache: hit`, `X-Treg-Fetched-At`, `X-Treg-Age`. Your
- team's first call on a question costs full price either way; from your second call on, a hit
- costs 10%, and a hit on your own key is free. `Cache-Control: no-cache` forces a live call;
- `X-Treg-Max-Age: <seconds>` accepts only a younger answer. A team admin can opt the team out
- of the archive (`treg org archive off`): new calls are then neither answered from nor stored
- in it, so metered calls lose the repeat price.
- - HTTP **503** `provider_capacity_unavailable` = treg's own account for that provider is out
- (not your balance; nothing charged). Body has `resets_at` and `alternatives` (same capability,
- other providers) — choose one, or use your own key. treg never switches providers for you.
- treg re-checks the provider about once a minute, so a retry after a minute can succeed.
- - HTTP **503** `provider_paused` = this deployment paused that provider (nothing charged, nothing
- sent). Read `message`. The existing connection is kept; do not reconnect, it works again when resumed.
- - An org tool or secret for the provider always wins over an anonymous route or treg's key,
- automatically — the catalog is the fallback, not a replacement for keys the team already has.
- - **Choosing between providers of one capability — the procedure.** `treg catalog get <id>` lists
- every provider serving the same job with `COST`, `WORKS` (success rate treg has observed, with the
- sample size), `SPEED` (median) and `LAST OK`. Work down this order:
- 1. **Match the inputs you actually HAVE.** An endpoint wanting a `profile_url` is not a substitute
- when you hold a name and a domain, whatever it costs. This rule outranks price every time.
- 2. Then **reliability**: a high `WORKS` with a real sample beats a rounder number with a tiny one —
- `99% (121)` is stronger evidence than `100% (8)`.
- 3. Then **price**. Spreads inside one capability reach 200×, so this is usually where the money is.
- 4. `LAST OK` breaks ties. A bare age means a real call came back; a **`✓` age is the catalog's own
- verification stamp, not live traffic**; `—` means nobody has verified it and nobody has called
- it — prefer almost anything else.
- - **If a call fails with 429 / 5xx / a timeout, try the next provider.** You know its parameters,
- so you can build its request. Say which one you switched to.
- - **Never retry a 4xx elsewhere.** A 4xx is usually your parameters; fixing them is the fix, and
- retrying burns the team's money on N providers for one mistake.
- - treg does **not** choose or fail over **between providers** for you. That is deliberate: only
- you know which inputs you hold, and treg relays rather than rewrites your request. If treg's
- own account for a provider is out it may serve the **same endpoint** through a treg-owned relay
- (`X-Treg-Served-Via: overflow:<name>`, or `served_via` + a hint on the MCP `call` result; real
- price, same shape). `catalog_get` shows that price up front as `overflow_price_usd` when the
- deployment can relay the endpoint - a "free" endpoint with one may bill exactly that, so quote
- it. A team opts out with `treg org overflow off`.
- - **For a common job, call the routed tool, not a provider you remember.** Scraping a page
- (`treg.web.extract`), web search (`treg.web.search`), Google results (`treg.google.serp.organic`,
- `treg.google.serp.maps`), finding or verifying an email (`treg.people.email.find`,
- `treg.people.email.verify`) and most social profiles have a `treg.<capability>` tool. treg picks
- the provider (your own key first), falls back when one fails or misses, and charges only the
- answer it returns. A provider you used last week may not be the best choice today: prices and
- reliability change. Name a provider only when you need fields or options that only it has.
- - **Routed endpoints** (`treg.<capability>`, e.g. `treg.people.email.find`) are where you can
- ask treg to choose: POST the identity (`{full_name, domain}` | `{first_name, last_name, domain}` |
- `{linkedin_url}`); treg runs the best child (own keys first, then cheapest per hit), falls back
- on errors AND misses (cheapest first, within `X-Treg-Route-Max-Cost`, default $1; a miss can be
- billed, so a routed row quotes `usd_per_call: null`, not $0 — set the header for bulk runs), and returns
- `{output, raw, _treg.served_by, _treg.tried}` + `X-Treg-Served-By`. `X-Treg-Route-Waterfall: 0`
- stops at the first miss. A filter a provider cannot apply (`country` on a name-only search) is
- still sent to the others, and the answer names it in `X-Treg-Ignored-Filters` / `_treg.ignored_filters`
- — post-filter, or send `X-Treg-Route-Strict-Filters: 1` to get a 422 (unbilled) instead of a looser
- answer. `catalog_get treg.people.email.find` shows the plan and prices.
- An async child is submitted and polled internally for up to 60 seconds. If it is still running,
- treg returns HTTP 202 with `_treg.outcome: pending`, its call reference and poll descriptor,
- `reserved_micro`, and `charged_micro: null`; do not retry or start another provider, because the
- existing task may still complete and charge.
- - **A found contact is not a confirmed one.** An email or phone find returns the provider's best
- match; only `output.verified: true` means it checked the mailbox. When it is not, the answer
- carries `_treg.advice` naming the verify step (`treg.people.email.verify`, a fraction of a cent)
- — run it before outreach, and never re-send the same find: every hit bills, repeats included.
- - **Verify before you send. Every address, every time.** This includes rows from a company or
- domain search (`treg.people.search`, `hunter.companies.emails`, …): those are directory
- listings, and a row's email is unconfirmed unless that row's own verification field says
- otherwise. Treat `invalid` as dead and `accept_all` as risky. And never send to an address the
- provider did not return — if a domain search came back empty, `info@` is a guess, not a result.
- Live 2026-09-08: 73 of one team's 79 bounces were unverified rows and guesses that one $0.006
- verify call each would have caught.
- - An endpoint with no published price is refused rather than served free; connect your own key.
+ goes to stderr, so a script that merges the streams still parses every answer. Run a handful and
+ check the parsed results before looping over the whole list: a parse bug throws away answers that
+ were already paid for.
+ - **Calling in parallel is fine**, within limits: treg sets no per-token or per-team concurrency
+ limit, and provider rate limits are relayed as they are. Where treg's own account for a provider is
+ at its limit of calls in progress, a team that already has calls running on it gets 429
+ `share_busy`: send fewer at once, or call the routed tool, which moves on by itself.
+ - **Over raw HTTP**, if a body carrying SQL or HTML is refused with an HTML 403 page by the hosting
+ edge before treg sees it, base64-encode the body and add `X-Treg-Body-Encoding: base64` (also
+ `gzip` or `base64+gzip`). The CLI does this by itself.
- ## Task - generate video, images, voice, or music
+ ## Money
- Generation models live in the catalog under the `video-gen`, `image-gen`, `voice-gen`, and `music-gen` platforms,
- one row per model per route, so the same model on two routes sits next to itself with both prices.
- Models are not interchangeable - you pick one; treg does not choose.
+ **Call at the listed price without asking, then report what it cost.** Prices are visible before a
+ call (`treg catalog get`, MCP `catalog_get`) and most are fractions of a cent. Before a generation
+ task or a loop over many inputs, tell the human the expected total and cap it with
+ `X-Treg-Route-Max-Cost`.
+ - **Read the `cost` block, not only the headline.** `per_call` is flat. `type: per_result` with
+ `unit: row` is priced per returned row, and its `~$/call` figure assumes a 20-row page (your
+ `limit` sets the real count). `unit: target`, `domain` or `keyword` is priced per thing you ask
+ about: one unit per target whatever the page size, so a body listing ten domains reserves ten.
+ - **What you were charged** is the response header `X-Treg-Cost-Micro` (integer micro-USD; `cost_usd`
+ over MCP), never anything in the provider's body. Keep `X-Treg-Call-Id` with it: it is the id to
+ quote, and `GET https://treg.to/calls/<call id>/result` returns the stored answer of a successful catalog
+ call you lost. The CLI prints `treg: charged $<usd> · call id <id>` on stderr; stdout is always
+ the exact body. On an asynchronous submission (a generation task) the header is the **reserved**
+ amount, not a charge: the task settles the real one when it succeeds and refunds it all when it
+ fails, so report it as reserved until the task is done.
+ - **A hard ceiling:** `X-Treg-Route-Max-Cost: <usd>` refuses a call whose reservation would exceed
+ it (402 `route_max_cost`, nothing charged). Direct calls have no default; on a routed call it also
+ bounds the whole waterfall, $1 by default.
+ - **Failed calls are free.** A 4xx or 5xx relayed from the provider costs nothing. Empty results mean
+ whatever the provider means by them; treg relays and does not normalise. A provider that reports
+ a failure inside a 2xx (a DataForSEO task status other than 20000) is flagged with
+ `X-Treg-Upstream-Failed` (`upstream_failed` over MCP): the body has no result, and the charge is
+ what the provider billed for the attempt.
+ - **Repeat questions are cheaper.** A call may be answered from treg's archive of the exact same
+ question while that answer is fresh: the provider's bytes, with `X-Treg-Cache: hit`,
+ `X-Treg-Fetched-At` and `X-Treg-Age`. The team's first call on a question costs full price; from
+ the second on, a hit costs 10%, and a hit on the team's own key is free. `Cache-Control: no-cache`
+ forces a live call; `X-Treg-Max-Age: <seconds>` accepts only a younger answer. A team admin can
+ turn the archive off for the team (`treg org archive off`).
+ - **When treg's own account for a provider runs out**, it may serve the same tool through a relay
+ account it owns: same request, same answer shape, the relay's real price, and
+ `X-Treg-Served-Via: overflow:<name>` (`served_via` over MCP). `catalog_get` shows that price
+ up front as `overflow_price_usd`; a "free" tool with one may bill exactly that, so quote it. The
+ team's own keys are never relayed; a team opts out with `treg org overflow off`.
+ - `treg balance` shows the balance and recent charges, and the dashboard's Activity page shows the
+ settled cost of every call. `treg topup` adds funds or sets up automatic top-ups.
+
+ ## When a call fails
+
+ treg's own refusals carry the header `X-Treg-Error: 1` (`whose_error: treg` over MCP); without it,
+ the status and body are the provider's. The CLI names whose answer it was on stderr. A bare 5xx with
+ no JSON `detail` is never treg's.
+
+ | you see | charged | what to do |
+ |---|---|---|
+ | a 4xx from the provider, other than 429 | no | Fix your request. Do not retry it with another provider. |
+ | a 429 or 5xx from the provider | no | Try the next provider of the job, and say which. |
+ | a timeout or dropped connection on your side | maybe | The provider may have answered and been paid. Repeat with the same `Idempotency-Key`; see below. |
+ | 403 `capability_pinned` | no | A team admin pinned this job to one provider. Call `use_endpoint` from the body instead. |
+ | 402 `insufficient_balance` | no | The body has `balance_micro`, `estimated_cost_micro`, `topup_url`. Check `treg balance`, then top up (`treg topup`, or the dashboard's Team → Billing) or connect the team's own key for that provider. |
+ | 402 `route_max_cost` | no | Your `X-Treg-Route-Max-Cost` refused it. Ask for fewer rows or targets, or raise the ceiling. |
+ | 429 `share_busy` | no | treg's account for that provider is at its limit and your team already has calls running on it. Send fewer at once, retry after `retry_after_s`, or call the routed tool. |
+ | 429 `trial_allowance_reached` | no | A free trial pool on treg's key is used up for today; it resets at 00:00 UTC. Connect the team's own key. |
+ | 429 `trial_allowance_unavailable` | no | Today's trial use could not be checked. Retry shortly. |
+ | 503 `provider_capacity_unavailable` | no | treg's own account for that provider is out. Take one of the body's `alternatives`, use the team's own key, or retry after `resets_at` or a minute. |
+ | 503 `provider_paused` | no | This registry paused that provider; read `message`. Use another provider. Do not reconnect: the team's connection is kept. |
+ | 503 with `treg_saturated: true` | no | Wait for `Retry-After`, then send the same request again. |
+ | `X-Treg-Capacity: exhausted` on any status | not when `X-Treg-Cost-Micro` is `0` | treg's own account for that tool refused for want of credit. Not your balance; try another tool. |
+ | 502 `route_failed` | `charged_micro` in the body | Every provider of a routed call failed or missed; `tried` lists them. Misses can be billed: read `charged_micro` before running it again. |
+ | 502 `response_buffer_limit` | no | The answer is over 8 MiB; narrow the request. If the message says it is temporary, treg is busy: retry shortly. |
+ | 409, 410 with an `idempotency_*` error | see below | See "Retrying without paying twice". |
+ | 426 on sign-in or a team command | no | The CLI is too old for this registry: `treg update`. |
+
+ ## Retrying without paying twice
+
+ A failed call (a 4xx or 5xx relayed from the provider) was never billed: fix it, or try another
+ provider. A timeout or a dropped connection on your side is different: the provider may have
+ answered and been paid before the answer was lost. Send an `Idempotency-Key` header
+ (`idempotency_key` over MCP) on any call you may need to repeat, and repeat it with the same key.
+ treg returns the stored answer, does not call the provider again and charges nothing; the reply
+ carries `X-Treg-Idempotent-Replay: true` (`replayed: true` over MCP), `X-Treg-Cost-Micro: 0`, and the
+ first call's charge in `X-Treg-Original-Cost-Micro`.
+
+ - Use a new idempotency key, or none, for new work, even with the same parameters: asking again to
+ see what changed is a new call, and the old key would hand back the old answer. Reusing one for a
+ different request is refused (422).
+ - Idempotency keys belong to the caller and last 24 hours; a call that fails frees its key at once.
+ - 409: the original call is still running; retry shortly.
+ - 410 (`idempotency_response_lost`, `idempotency_response_too_large` over the 2 MB replay limit,
+ `idempotency_outcome_unknown`): the first call was, or may have been, charged and its answer was
+ not kept. The body names the `call_id`; `GET https://treg.to/calls/<call id>` shows the cost and
+ `/result` any stored answer. A new idempotency key calls again.
+
+ ## Generate video, images, voice or music
+
+ Generation models are in the catalog under the `video-gen`, `image-gen`, `voice-gen` and `music-gen`
+ platforms, one row per model per route, so one model on two routes sits beside itself with both
+ prices. Models are not interchangeable: you pick one, treg does not.
+
```bash
treg catalog search "text to video" # every model, with prices
- treg catalog get minimax.video-gen.h3.generate # native params, model enum, price table, async descriptor
- treg call minimax.video-gen.h3.generate --await --timeout 900 --data '{"model":"MiniMax-H3-Max",
- "content":[{"type":"text","text":"A paper boat drifts across a quiet pond at sunrise."}],
- "resolution":"480P","duration":5,"ratio":"16:9"}'
- treg call minimax.voice-gen.voices.list --data '{"voice_type":"system"}'
- treg catalog get minimax.voice-gen.speech-2-8-turbo
- treg call minimax.voice-gen.speech-2-8-turbo --data '{"model":"speech-2.8-turbo",
- "text":"A calm voice can make a complex idea feel simple.","stream":false,"output_format":"url",
- "voice_setting":{"voice_id":"English_expressive_narrator","speed":1,"vol":1,"pitch":0}}'
+ treg catalog get minimax.video-gen.h3.generate # native parameters, model enum, price, a ready call line
+ treg call minimax.video-gen.h3.generate --await --timeout 900 --data @body.json
```
- How it works:
- - **Voice generation is synchronous.** MiniMax returns JSON containing a 24-hour audio URL. The
- catalog route fixes `stream:false` and `output_format:"url"`; use the voice-list action to discover
- valid system voice IDs, then choose HD or Turbo by endpoint id.
- - **Fish Audio is binary and team-scoped on the platform key.** Use
- `fishaudio.tts.s2-1-pro` with header `model: s2.1-pro`; redirect CLI stdout to an audio file or use
- MCP `call_media`. To use a Fish-supplied voice, call `fishaudio.voices.discover` with
- `self=false` and `licensed=true|false`, then pass a returned `_id` as `reference_id`; `true`
- selects Fish's rights-secured subset and `false` includes public/community voices. treg rechecks
- that non-team id as public before platform-key synthesis. Create reusable
- private voices with `fishaudio.voices.create`, then list their ids with
- `treg resources list --provider fishaudio --kind voice` or MCP `resources_list`. Those list the
- connected Fish account under BYOK and otherwise list only the current team's platform voices; curl uses
- `GET /orgs/{org_id}/provider-resources?provider=fishaudio&kind=voice`. BYOK remains an unrestricted
- unmetered relay. `treg resources list` requires CLI ≥ 0.21.0; run `treg update` if the
- `resources` command is unrecognised.
- - **A video or image generation call is an async task.** The submission returns a task id at once; `--await` polls
- the provider until it finishes and prints the **final response only** on stdout. stderr carries the
- task id, a resumable `treg call …` command (Ctrl-C loses the wait, never the task or the money),
- progress, and the result URL. Exit 0 = done, 2 = the provider failed the task, 3 = timed out
- (resume with the printed command).
- - **Some async tools usually answer at once** (an email verification): when the first response is
- already finished, it is the answer and is charged as one; `--await` prints it without polling. If
- it says "still working", poll no faster than the descriptor's `interval` and stop at its `max_age`
- seconds; a task with no answer by then is refunded.
- - **Reference media (a face image, a voice clip, a first frame) must be a public URL the vendor
- can fetch.** Do not reach for a paste host: they fail vendor probes at random (catbox, tmpfiles,
- uguu all did). `treg host face.jpg` prints a public URL (30 MB, 7 days, free) that drops straight
- into `image_urls` / `audio_urls`: `--data "{\"image_urls\":[\"$(treg host face.jpg)\"], …}"`.
- Requires CLI ≥ 0.20.0; run `treg update` if `treg host` is unrecognised.
+
+ - **Video and image generation is an asynchronous task.** The submission returns a task id at once
+ and reserves the price; it is charged only when the task succeeds, and a failed or moderated task
+ refunds the whole hold. `--await` polls until it finishes and prints only the final response on
+ stdout; stderr carries the task id, a resumable `treg call …` command (Ctrl-C loses the wait,
+ never the task or the money), progress and the result URL. Exit 0 is done, 2 means the provider
+ failed the task, 3 a timeout (resume with the printed command).
- **CLI agents: raise your shell tool's timeout or run the call in the background.** A video takes
- 1-5 minutes; a runtime's default 2-minute command limit cuts it off mid-wait.
- - **MCP and raw-HTTP agents:** the response header `X-Treg-Async` is the descriptor - where to poll,
- which status values are terminal, where the result is. Poll lazily: wait ~60 s before the first
- check, then every 30-60 s; three to six checks per video is normal. Do other work in between.
- - Parameters are the provider's own, verbatim; `treg catalog get` shows them, including the
- enum of selectable models and resolutions. Nothing is translated between providers.
- - **Money:** the price is reserved at submission and charged only when the task succeeds. A failed
- or moderated task refunds the whole hold - nothing to do on your side. `treg audit` and the
- dashboard's Activity page show each task's state (`generating…` → `done` / `failed · refunded`)
- with the result link once it exists.
- - **Result URLs expire** (the descriptor's `ttl_note` says how soon; MiniMax's ~9h). Download
- promptly; treg never stores the media. On some routes the file needs one more call -
- `--await` prints that exact command instead of downloading.
- - Responses needing settlement or task-ownership evidence are limited to 8 MiB. Larger responses
- return `502` with `detail.error=response_buffer_limit` and no charge; retrying the same oversized
- response will not help. Authorized free final downloads needing no body evidence stream in full.
- Such downloads are fetched again on retry, not retained for local idempotent replay.
- - A tool whose answer inlines media (Google AI's images, speech and Lyria music arrive as base64 in the JSON) is
- exempt from the 8 MiB limit up to 64 MiB and is charged from the provider's reported usage. Its
- answer is never replayed: an `Idempotency-Key` retry generates, and bills, a new image. A
- `response_buffer_limit` whose message says it is temporary means treg is busy: retry shortly.
+ 1-5 minutes, and a default 2-minute command limit cuts the wait off.
+ - **MCP and raw HTTP:** the response header `X-Treg-Async` is the descriptor: where to poll, which
+ statuses are final, where the result is. Wait about 60 s before the first check, then every
+ 30-60 s; three to six checks per video is normal. Do other work in between.
+ - **Some asynchronous tools usually answer at once** (an email verification): a first response that
+ is already finished is the answer and is charged as one. If it says it is still working, poll no
+ faster than the descriptor's `interval` and stop at its `max_age`; a task with no answer by then
+ is refunded.
+ - **Result URLs expire** (the descriptor's `ttl_note` says when). Download
+ promptly: treg never stores generated media. On some routes the file needs one more call, and
+ `--await` prints that command.
+ - **Reference media** (a face, a voice clip, a first frame) must be at a public URL the vendor can
+ fetch. Paste hosts fail vendor probes at random; `treg host face.jpg` prints a public URL (30 MB,
+ 7 days, free) to put in `image_urls` or `audio_urls`.
+ - **Binary answers** (speech from some providers): redirect stdout to a file, or use MCP
+ `call_media`. Provider objects the team created, such as cloned voices, are listed by
+ `treg resources list --provider <provider>` (MCP `resources_list`).
+ - A tool whose answer inlines media as base64 (Google AI's images, speech and Lyria music) may answer
+ up to 64 MiB and is charged from the provider's reported usage. Its answer is never replayed: an
+ `Idempotency-Key` retry generates, and bills, a new one.
+ - Parameters are the provider's own, verbatim. Nothing is translated between providers.
- ## Retrying a call without paying twice
+ ## Your own tools
- If a call times out or you never see its answer, repeat it with the same `idempotency_key` (over MCP)
- or `Idempotency-Key` header (over HTTP). treg returns the stored answer, does not call the provider
- again, and charges nothing. The result says `replayed: true`.
+ **Start from what the team registered, then use each API exactly as its own docs say.**
- Only for a genuine retry. Asking the same question again to see what changed is NEW work: use a new
- key or none, or you will get the old answer back. Reusing one key for a different request is refused.
- A 409 means the original call is still running: retry shortly. A 410 `idempotency_response_lost` means
- it was charged but its answer was not kept: try `GET /calls/{call_id}/result`, or use a new key.
- A 410 `idempotency_outcome_unknown` means its outcome was not recorded: `GET /calls/{call_id}` shows the cost; use a new key.
+ ```bash
+ treg tool ls # the team's tools: names, hosts, which credential goes where
+ treg call intercom conversations?per_page=5 # <tool-name> and the upstream path
+ ```
- Most retries need none of this — a failed call was never billed.
+ Over HTTP that is `https://treg.to/call/<tool-name>/<path>`, or the upstream URL behind the prefix,
+ `https://treg.to/call/https://api.intercom.io/me`, with `X-Treg-Token: <token>`. With a personal sign-in
+ token, also send `X-Treg-Org: <team-slug>`; a team token does not need it. treg finds the tool,
+ injects the team's credential on the server, and relays method, query, headers and body unchanged;
+ your `X-Treg-Token` is removed before the provider sees the request. `GET https://treg.to/tools` lists the
+ tools as JSON.
- Catalog entries marked `strict_query: true` accept only their declared query parameters, once each. Include required fields, use allowed values and omit the request body.
+ **Command-line tools** (stripe, gh, vercel, gcloud and others) run with the team's credential and
+ without you logging in:
- ## Task — your own tools: call one the team registered
+ - `treg <command>` is the simplest: `treg claude`, `treg node server.js`, `treg with -- npm test`
+ run that one command with the team's credentials, and nothing else changes. Calls to a registered
+ host are credentialed by the server; every other address goes out untouched. Node before version
+ 24 ignores proxy settings in its built-in `fetch`, so such a call goes out with no credential: use
+ a client that reads the environment (axios, got, undici `ProxyAgent`) or Node 24+. curl, git,
+ Python requests and httpx, and Deno are covered at any version.
+ - `treg run stripe -- balance retrieve` runs one vendor CLI. `--local` (the default) runs it on this
+ machine, isolated under a dedicated user once an admin has run `sudo treg setup-local-run`;
+ `--server` runs it on the registry so the key never reaches the machine.
+ - `treg shell start` opens a subshell where registered CLIs get their credentials by themselves;
+ `--proxy` also credentials HTTPS calls your own code makes to a registered API. `treg serve` runs
+ the same proxy as a background service. A certificate-pinned client refuses the interception: use
+ `treg run` or `treg call` for it.
- **Start from what is registered, then use the API exactly as its own docs say.** No treg vocabulary,
- no special params:
+ [Import and shell](https://treg.to/tutorial-import-shell.md) has the full walkthrough.
- ```
- treg tool ls # what this team has registered
- treg call intercom conversations?per_page=5 # <tool-name> + the upstream path
- ```
+ **Connecting a key for catalog calls.** `treg connections connect --provider <provider>` connects a
+ provider the catalog knows: a consent screen for OAuth providers; for key-based ones a hidden
+ prompt, or the key piped with `--key-stdin`. treg verifies it first. From then on the team's calls
+ to that provider use its key and are never billed.
- Over HTTP that is `GET https://treg.to/call/<tool-name>/<path>` with `X-Treg-Token: <your token>`. treg looks
- up the named tool, injects that team's credential server-side, and relays **everything faithfully**
- (method, query params, your headers, body). Your `X-Treg-Token` is stripped before the upstream sees
- it. Works for GET/POST/PUT/PATCH/DELETE.
+ ## Share keys and skills with the team
- Only tools this org has registered resolve. Discover them with `treg tool ls` · `treg skill ls`.
+ **Bulk is fastest.** In the directory the human names, `treg upload` lists the provider keys it
+ recognises in `.env` and the skills in the subfolders, and registers only the ones picked
+ (`treg upload env|skills --dir <dir>` restricts it; `treg scan` previews and sends nothing). It reads
+ variable names, and loads a value only for a key that is picked. Without a terminal it refuses
+ unless you pass `--select a,b` or `--all`, so nothing is imported by accident.
- ## Task — share your keys & skills so teammates' agents can use them
- **Bulk (the fast path):** run it in the directory the human names. It lists the provider keys it
- recognises in that `.env` and the skills in its subdirs, and registers only the ones they tick:
- ```bash
- treg upload # both sides of the cwd; `treg upload env|skills --dir <d>` to restrict
- ```
- **Default: wrap new keys in a skill.** When registering a new key/endpoint/CLI, pair it with
- a skill so credential, tool, and recipe land together (and it gets a shareable page). If no
- skill exists, create a basic one — a proper SKILL.md (frontmatter matters: agents discover
- skills by it) + one example call:
+ **Wrap a new key in a skill.** Registering a key, an API or a CLI, pair it with a skill, so the
+ credential, the tool and the recipe land together. If none exists, write a basic one: a SKILL.md
+ with frontmatter (agents find skills by it) and one example call.
+
```bash
mkdir -p ./posthog && cat > ./posthog/SKILL.md <<'MD'
---
name: posthog
- description: Query the PostHog analytics API through treg — the key is injected server-side. Use for events, insights, and project queries.
+ description: Query the PostHog analytics API through treg; the key is injected on the server. Use for events, insights and project queries.
---
Call it: `treg call posthog api/projects/@current` (upstream: https://us.posthog.com)
MD
- treg skill init --dir ./posthog # drafts treg.json: base_url from the catalog (folder name) or URLs in SKILL.md; review it + add the key
- treg skill add --dir ./posthog # registers recipe + secret + tool atomically
+ treg skill init --dir ./posthog # drafts treg.json (base URL, the secrets); review it and add the key
+ treg skill add --dir ./posthog # registers the recipe, the secret and the tool together
```
- **Never orphan a secret:** a stored key nothing binds is dead weight — if you use `secret add`
- directly, bind it to a tool (endpoint/CLI) in the same breath.
- **Bare endpoint, no recipe (only when a skill adds nothing):**
+
+ **A bare tool, only when a recipe adds nothing.** Never store a key without binding it to a tool.
+
```bash
- treg secret add posthog-key --value "$POSTHOG_API_KEY" # or --file ./.secret/token.json
+ treg secret add posthog-key --value "$POSTHOG_API_KEY" # or --file ./.secret/token.json
treg tool add posthog --base-url https://us.posthog.com --secret posthog-key
- # query-key API instead of a bearer header:
+ # a key that goes in the query string instead of a header:
treg tool add serpapi --base-url https://serpapi.com --secret <name-or-id> \
--auth-in query --auth-name api_key --auth-format '{secret}'
```
- **A whole skill (recipe + secrets + tool, possibly multi-credential):**
- ```bash
- treg skill scaffold ~/.claude/skills/google-ads --out gads.json
- # -> walks the dir: captures SKILL.md as the recipe + every .secret/* as a secret.
- # -> YOU then edit gads.json: set base_url, and complete each binding (location/name/format).
- # e.g. google-ads needs TWO bindings on one request:
- # Authorization: Bearer {access_token} (injector: oauth)
- # developer-token: {secret} (injector: env)
- treg skill push gads.json # registers the bundle atomically
- ```
- Share it inside the org: give a teammate the endpoint + tool name and their agent can call it
- **without being handed the credential** — you granted the access, treg injects the secret, and the
- call is logged against their token.
- **Auth shapes** (per binding `injector`, = the secret's `kind`): `env` (plain string) ·
- `secret_file` (JSON token file, pull `secret_field`) · `oauth` (JSON token, auto-refreshed) ·
- `cli_auth` (a token the human copied out of a CLI they are already signed into, and supplied to treg
- themselves). Multiple bindings apply to every request.
+ **A whole skill with several credentials:** `treg skill scaffold ~/.claude/skills/google-ads --out
+ gads.json` captures SKILL.md as the recipe and every `.secret/*` file as a secret; complete each
+ binding in `gads.json` (google-ads needs `Authorization: Bearer {access_token}` from an `oauth`
+ secret and `developer-token: {secret}` from an `env` one), then `treg skill push gads.json`.
- **OAuth, two modes (treg keeps it fresh):** if the oauth secret carries `refresh_token` +
- `client_id` + `client_secret`, treg **auto-refreshes** it before it expires (you never re-upload).
- If it's just a bare token, that's **manual mode**, treg injects it as-is and you re-upload when it
- expires. Same storage; a credential can graduate from manual to auto with no migration.
+ A teammate's agent then calls the tool without ever holding the credential, and each call is logged
+ against its own token. `treg skill install <name>` (or `--all`) writes a shared skill's recipe into
+ `.claude/skills/<name>/SKILL.md`.
- **Getting the first OAuth token, two ways (your choice):**
- - **Manual:** do your own OAuth locally, then `treg secret add gsc --file token.json --kind oauth`.
- - **Hosted connect:** `treg oauth connect gsc --client-secret client_secret.json --scopes <scope>`
- → prints a consent URL; you approve in the browser; treg captures the token directly.
- One-time setup: add `https://treg.to/oauth/callback` to your OAuth app's redirect URIs.
+ **Credential shapes**, one per binding: `env` (a plain string), `secret_file` (a JSON file, of which
+ `secret_field` is injected), `oauth` (a JSON token, refreshed automatically) and `cli_auth` (a token
+ the human copied from a CLI they are signed into). Every binding of a tool applies to every call.
+ An oauth secret carrying `refresh_token`, `client_id` and `client_secret` is refreshed before it
+ expires; a bare token is injected as it is and re-uploaded when it expires. To get a first OAuth
+ token, either run the flow yourself and `treg secret add gsc --file token.json --kind oauth`, or let
+ treg host it: `treg oauth connect gsc --client-secret client_secret.json --scopes <scope>` prints a
+ consent URL, and `https://treg.to/oauth/callback` must be among the OAuth app's redirect URIs.
- ## Task — manage the team + monitor
+ ## Run the team
- An account can own up to 10 teams. Joining other teams as a member does not count toward this limit.
```bash
- treg tool ls / secret ls / skill ls / calls # inventory + audit log — scoped to the active org
- treg tool rm <id> / secret rm <id> / skill rm <id> # secret rm is blocked while a tool binds it
- treg health # status of every credential in this org (ok | invalid | unknown)
- treg health --run # re-check now: refresh oauth tokens, probe each tool, alert owners
- ```
- **Teams / orgs** (owner > admin > member > viewer; a member manages only what they created):
- ```bash
- treg org create "Team A" # you become owner (auto-active)
- treg org rename --name "Team B" --slug team-b # admin+; existing keys keep working
- treg org invite bob@company.com --role member # admin+; emails the invite (a one-time code is the fallback)
- treg org members # admin+; who's in the active org
- treg org ls / treg org use <slug> # your orgs / switch active
+ treg tool ls · treg secret ls · treg skill ls # what the active team has
+ treg calls · treg audit # who called what, with results and costs
+ treg health [--run] # every credential: ok, invalid or unknown; --run re-checks now
+ treg tool update <id> --health '{"path":"me"}' # the probe treg health uses for a tool
+ treg org create "Team A" # you become its owner
+ treg org invite bob@company.com --role member # admin+
+ treg org members · treg org ls · treg org use <slug>
+ treg org pin <capability> --provider <p> # admin+: this job uses this provider only
```
- **Give an agent its own identity** (admin+). An agent doesn't have to borrow the human's token — mint
- it one, and every call it makes is capped, scoped and logged as *itself*:
+
+ **Roles:** a viewer calls tools and reads the inventory; a member also registers secrets, tools and
+ skills and manages their own; an admin also invites and manages anyone's; an owner also changes
+ roles and deletes the team. An account can own up to 10 teams; joining others does not count.
+ `treg secret rm` is refused while a tool binds the secret.
+
+ **Give an agent its own identity** (admin+) instead of the human's token. Every call it makes is then
+ capped, scoped and logged as itself:
+
```bash
- treg org agent-new customer-bot --pin customer=cust_A # scope history and shared-provider async reads
- treg org agent-new ci-bot # prints the token ONCE (run again to rotate)
- treg org agent-new ci-bot --tools stripe,gh --cap 500 # only these tools, 500 calls/day
- treg org agents # who the team's agents are + today's usage
- treg org agent-rm <user_id> # revoke instantly
+ treg org agent-new ci-bot # prints the token once (run again to rotate)
+ treg org agent-new ci-bot --tools stripe,gh --cap 500 # only these tools, 500 calls a day
+ treg org agent-new customer-bot --pin customer=cust_A # bills and reads only that customer's calls
+ treg org agents · treg org agent-rm <user_id> # who they are and today's use; revoke
```
- Put that token in the agent's `TREG_TOKEN` env var. An agent token can **call this team's tools and
- read** — it can never sign in, create a team, or be an owner. If you are an agent and you were given
- your own token, use it instead of the machine owner's: your work then shows up under your own name in
- `treg calls`.
- The invitee signs in with the invited email and runs `treg accept` — no code handling needed
- (the code path still works: `treg org join <code>`). A brand-new invitee also gets their own
- **personal org** (no empty state), so removing them from a team never locks them out. Give a tool
- a probe so treg can validate it: `health_check: {method, path, expect_status}` (e.g. intercom `{"path":"me"}`).
-
- ## Feedback
+ Put that token in the agent's `TREG_TOKEN`. An agent token calls the team's tools and reads; it can
+ never sign in, create a team or own one. If you are an agent with a token of your own, use it rather
+ than the machine owner's: your calls then appear under your own name.
- Proactively share problems and suggestions about treg. Small annoyances that slowed your task
- down count too: unclear instructions, confusing results or charges, unhelpful errors, and
- missing capabilities you worked around, even if the task succeeded. Describe what you needed and
- observed; you do not need to prove a bug. Distinguish observations from suspected causes.
- Use the `feedback` tool over MCP, or `treg feedback submit <quality|pricing|friction|other>
- "message"` over CLI. Pass related call IDs in `call_ids` (CLI: `--call-id`), not only in the
- message; references are optional.
- Report each issue once. Feedback helps the treg team improve the product; it does not complete
- the user's task. Keep going afterward.
- Keep private information out of the report. See [feedback instructions](https://treg.to/feedback.md).
+ ## Feedback and reviews
- ## Review
+ Report problems and suggestions about treg as you meet them, small ones included (unclear
+ instructions, confusing results or charges, unhelpful errors, workarounds), even when the task
+ succeeded: `treg feedback submit <quality|pricing|friction|other> "message" --call-id <id>`, or MCP
+ `feedback`. Report each issue once, keep private information out, then carry on. See
+ [feedback instructions](https://treg.to/feedback.md).
- If a call result invites a review, rate that one call after using it:
- `review(call_id, usefulness, reason?)` over MCP or `treg review CALL_ID USEFULNESS [--reason "..."]`.
- Choose `useful`, `partly`, `not_useful`, or `not_sure`; uncertainty is fine. One review per
- invitation; a review of an uninvited call is accepted, and a team counts once per endpoint. Reasons
- may be quoted on the endpoint's catalog page without naming your team: write about the endpoint, omit
- private data, use `feedback` for anything confusing or wrong, then continue.
+ When a result invites a review, rate that call after using it: `treg review CALL_ID USEFULNESS
+ [--reason "..."]` or MCP `review`, with `useful`, `partly`, `not_useful` or `not_sure`. A reason may
+ be quoted on the tool's catalog page without naming your team, so write about the tool.
## Rules
- - Secrets are **write-only** — the API never returns a stored value, to you or to anyone.
- - A tool may bind a secret **a teammate shared with this org** (use-without-hold) — that's the point:
- they chose to share it, it stays scoped to the org, you can spend it without seeing it, and every
- call is attributed to the token that made it. It is delegated access inside one team, never access
- to a credential nobody granted you.
- - **Everything is scoped to your active org.** A token reaches that team's tools and no one else's.
- - The proxy doesn't understand the upstream; if a call fails, the status you see is the upstream's truth.
- - More: `https://treg.to/llms.txt` (agent onboarding) · `https://treg.to/tutorial` (interactive walkthrough).
+
+ - **Follow the next step an answer names**: a `help` line, `_treg.advice`, an error body.
+ - **Never ask for or paste a provider key.** Register it once; the team calls it without holding it.
+ - **Keys are write-only.** No one can read a stored value back, you included. A tool may use a key a
+ teammate shared with the team: you spend it without seeing it, and every call is logged against
+ the token that made it.
+ - **Everything is scoped to the active team.** A token reaches that team's tools and nobody else's.
+ - **treg relays, it does not interpret.** A provider's status and body are the provider's truth.
+ - More: `https://treg.to/llms.txt` (the overview) and the [tutorial](https://treg.to/tutorial.md).