Treg (GitHub Repo)
Treg is a unified proxy that allows AI agents to access over 3,000 API endpoints across 60+ providers using a single token and pay-per-call billing.
Deep dive
- Acts as a unified API proxy for over 3,000 endpoints.
- Supports both catalogued shared keys and user-provided private keys.
- Handles authentication server-side to prevent sensitive key exposure to agents.
- Provides a CLI tool for searching, calling, and auditing tool usage.
- Includes support for CLIs and custom 'skills' via recipes.
- Implemented as a streaming proxy to minimize latency and memory overhead.
Decoder
- API Proxy: A service that acts as an intermediary between a client and a web service, often used to aggregate or secure access to multiple backends.
- Credential Injection: The automated process of adding authentication headers or keys to a request before it reaches the upstream service.
- MCP (Model Context Protocol): An open standard that enables AI models to connect to external data sources and tools.
Original article
Treg (OpenRouter for Tools)
OpenRouter, but for agent tools instead of models. Point an agent at one base URL with one token and it can do the job: 3,000+ catalogued endpoints across 60+ providers — SEO and backlinks, social and trends, people and company enrichment, ads, scraping, image and video generation — priced per call, from a cent, with no provider signup. Plus your own team's keys, skills and CLIs, callable by every teammate's agent without the credential ever leaving the server.
Ask for the task, not the tool. You do not need to know which vendor sells backlink data, or to hold an account with them. Search for what you want to do, read the price, call it.
Built for the Superdesign team, live at treg.to — anyone can self-host.
Why it exists
The tools an agent needs for real work sit behind subscriptions nobody buys for a single run — Semrush $139/mo, Moz $99/mo, Crunchbase $99/mo, Apollo $59/seat — behind signup walls, or behind no public API at all (invite-only, partner-only, app-review-only). treg carries those accounts and bills fractions of a cent per call.
Two kinds of tool, one token
- The catalog — external endpoints treg can serve with its own key or through a verified public route that needs no provider key. Own-key calls use the team's prepaid balance; anonymous calls are free. No account with the provider is needed. New verified accounts receive $1.00 free once, when they create an eligible team.
- Your own tools — anything a teammate registered: a paid API account, an OAuth connection, a vendor CLI, a
SKILL.md. Your own key always wins over treg's, and those calls are never metered.
The vocabulary for the second half:
- 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 secret into the request; a request can carry several, e.g. an OAuth bearer and adeveloper-tokenheader). - CLI — a vendor binary (
stripe,gh,vercel, ...) run with the credential injected.
- endpoint — an upstream
- skill / bundle = a recipe (
SKILL.md) + its secrets + its tool(s), registered together.
The one rule: the proxy relays, never models the upstream, and injects auth server-side — so it survives upstream API changes and callers never hold keys.
Part 1 · Using the registry
Visit treg.to (hosted on Render) — the dashboard, sign-in, and every URL below live there.
Quickstart
Same flow as the dashboard's Getting started guide:
# 1. install the CLI — also points it at the registry
curl -fsSL https://treg.to/install.sh | sh
# 2. sign in (GitHub default · --email for a one-time code · --token for agents/CI)
treg login
# 3. do something useful immediately — no key, nothing registered
treg catalog search "backlinks for a domain" # find a tool by what it DOES
treg call tikhub.tiktok.user.profile --query uniqueId=tiktok
treg balance # exactly what that cost
# (or `treg onboard` for the guided walkthrough)
Fish Audio provides S2.1 Pro speech, public-voice discovery, and private voice cloning. Speech is binary stdout, so redirect it to a file. A discovered voice's _id or a team voice id is the TTS reference_id; voices created on treg's Fish account are durable team resources:
treg call fishaudio.tts.s2-1-pro --method POST --header model=s2.1-pro \
--data '{"text":"Hello from treg","format":"mp3"}' > speech.mp3
treg call fishaudio.voices.discover --query self=false --query licensed=false --query language=en
treg resources list --provider fishaudio --kind voice
With your own Fish key, requests remain an unrestricted, unmetered upstream relay and Fish owns the account boundary.
Catalog tool inputs are described by treg catalog get <id>. Tools marked strict_query reject undeclared or repeated query parameters, unsupported values and request bodies.
Your token identifies you on every call (X-Treg-Token header) and is the same for all tools. Discover what your team has shared: treg tool ls · check credential health: treg health.
Or install it as a Claude Code plugin
/plugin marketplace add superdesigndev/treg
/plugin install treg@treg
Installs with no token and no configuration. The skill loads as treg:treg and, on its first run, walks your agent through the rest — the CLI, sign-in, then treg mcp install — so you end up with the command line and treg's tools. Other agents: npx skills add superdesigndev/treg -s treg (the -s matters — without it you also get this repo's internal dev skills).
Claude.ai connector
The Claude Connectors Directory surface is https://treg.to/mcp/v2/. It exposes only curated catalog endpoints and separates read calls from write calls so Claude receives accurate safety signals.
Call a tool you don't have a key for
The catalog is grouped by what endpoints do: keyword and rank tracking, backlinks and authority, AI visibility, trending and discovery, publishing to socials, people and company enrichment, ads management and creative, measurement.
treg catalog # every platform, busiest first
treg catalog search "find a work email" # by the job, not the vendor
treg catalog get hunter.people.email.find # params, PRICE, example response
treg call hunter.people.email.find --query domain=reddit.com --query full_name="Alexis Ohanian"
How a catalogued call is served — the credential ladder, in order:
- your team registered its own tool for that provider → that tool, that key;
- your team stored a secret for the provider → injected through a virtual tool;
- neither, and the endpoint has a verified public route → no provider key, free;
- otherwise → treg's own key, billed to the team's prepaid balance.
The anonymous price assumes the caller does not send a provider credential header. The faithful relay preserves caller headers, so a caller-supplied provider key can use that key's credits. Your own credential always beats treg's, so connecting a key you already pay for makes those calls free of the balance rather than duplicating them. An endpoint treg has no published price for is refused, not served free — you are told to connect your own key instead. Where several providers serve one capability, treg catalog search shows them side by side with prices; choosing is yours — treg does not silently pick or fail over between providers for you.
treg balance # credit left, calls in flight, recent spend
treg topup # add funds, or set up automatic top-ups
Out of balance is an HTTP 402 carrying balance_micro, estimated_cost_micro and a topup_url, so an agent can act on it without reading prose.
Share & use your own tools
The zero-thought path — point treg at a project and it figures out what's shareable:
treg scan # read-only preview: the keys, skills & CLIs upload would register
treg upload # register them (encrypted server-side); idempotent, --replace to update
treg upload scans the .env (matching keys against ~80 known providers), every skill subdirectory, and installed catalog CLIs. Three kinds of things go into the registry — here's how to share and use each:
1. Endpoints (HTTP APIs)
Share — one upstream URL callable with a stored key, or bulk from a .env:
treg secret add STRIPE_KEY --value sk_live_123
treg add stripe --base-url https://api.stripe.com --secret STRIPE_KEY
treg upload env --select openai,stripe,resend # or straight from the .env
Use — the agent-native way: build the real upstream request and prefix it with the proxy. treg resolves the tool by host, injects the credential, and relays everything else faithfully:
Real request: GET https://api.intercom.io/conversations?per_page=5
Through treg: GET https://treg.to/call/https://api.intercom.io/conversations?per_page=5
header: X-Treg-Token: <your token>
2. CLIs
Share — automatic: treg upload detects installed catalog CLIs (stripe, gh, vercel, …) and registers them; a recipe-only catalog CLI skill (e.g. stripe-cli) auto-becomes runnable too.
Use — treg run executes the vendor CLI with the org's credential injected, so you never hold the key or log in:
treg run stripe -- get /v1/balance
treg run gh -- pr list
treg run --server agentmail-cli inboxes list # runs on the registry server: the key never reaches you
3. Skills
Share — a skill is a whole capability (SKILL.md recipe + its secrets + its tool(s)), registered together so the whole team runs the same skill, maintained in one place.
Use — pull any shared skill into your agent; its API calls go through treg with your token, so the key stays on the server, never in the skill.
Teams
An account can own up to 10 teams. Everything is scoped to an org: a token = a (user, org) membership, and every secret, tool, and skill belongs to the active org. Roles: owner / admin / member / viewer.
treg org create "Acme" # make a team, become owner
treg org invite teammate@acme.com # invite by email (pick role + tool access)
treg org join <code> --email you@acme.com # accept an invite (creates you if new)
Part 2 · Self-hosting & development
Run it locally
One command (needs tmux + uv; it syncs the venv itself):
scripts/dev-local.sh up # server on http://localhost:18790, dev-safe settings
That runs the server in tmux with hot-reload, its own sqlite DB, and email OTP dev mode.
Installing to run a server (not from source): the base package is the CLI only. To run a registry, install the server extra —
pip install "tools-registry[server]"— which adds FastAPI, the database drivers, and encryption.
Architecture
Request flow for /call: resolve tool (by URL host + longest base_url prefix, or by name) → decrypt its secret(s) → apply each binding's injector → stream to the upstream → fire-and-forget audit record.
Faithful-relay contract: the proxy alters only three things, everything else is verbatim:
- hop-by-hop transport headers (re-derived per hop),
- treg's own control + edge-forwarding headers and session cookie — all stripped, never leak upstream,
- the injected credential(s).
License
Apache 2.0 with additional terms: use it freely — including commercially, inside your own organization (self-hosting your own registry is encouraged). The restriction: don't redistribute the code to third parties as a competing hosted/managed registry service without written permission.
Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi