Tryx402

io.github.crypto-yannso由 GitHub 帳號 crypto-yannso 發布v0.2.0更新於 Oct 24, 2026

Budget router over x402: hard budget caps, idempotent paid calls, cost ledger, server-side pricing.

已驗證STDIO僅桌面金融開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理在硬性美元預算上限內搜尋、詢價並安全呼叫付費 x402 端點,具備冪等與成本帳本。

可以做什麼
在目錄中搜尋與探索 x402 端點和工具,無須付費,並可在花錢前估算多步驟工作流程的成本。依單次價格與硬性預算上限呼叫任意 x402 端點,具備冪等保護,並在收到付款要求後僅重試一次。透過成本帳本檢視支出,並取得簽章收據作為付款證明。託管版本還可管理託管帳戶:工作階段權杖、餘額查詢、額度儲值與代理呼叫。
適用情境
當助理需要呼叫按次付費的 x402 或 AgentCash 端點,且你希望支出受硬性上限約束、避免重複扣款並保留付款紀錄時使用。也適合在真正花錢前為規劃中的工作流程詢價。
執行需求
以 pip 安裝的 Python 套件在本機執行。付費呼叫需要相容於 x402 或 AgentCash 的加密錢包。託管版本需要託管帳戶與 TRYX402_API_KEY 密鑰;預算上限透過 GATEWAY_MAX_BUDGET_USD 設定。需要連線至目標端點與託管服務的網路。
安裝前請注意
付費呼叫會從錢包實際支出 USDC,託管額度則透過 Stripe 另行儲值;請審慎設定預算上限。託管版本可儲值額度並代理呼叫。首次匯入時會傳送一次選用的匿名遙測,可用 TRYX402_NO_TELEMETRY 或空的 TRYX402_TELEMETRY_URL 關閉。請妥善保管 TRYX402_API_KEY。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Tryx402,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

tryx402 — the OpenRouter for agent payments

MIT licensed. Built in France. The first open-source payment governance layer for AI agents.

A safe, provider-agnostic wrapper over AgentCash / x402. Not limited to prospecting — it drives any endpoint, and adds what AgentCash itself lacks and we learned we need the hard way:

  • hard budget caps — stop before overspending
  • idempotency — never pay twice for the same call (the $0.83 double-charge lesson)
  • cost ledger — USD spent, reconciled, grouped by origin / account
  • plan estimation — price a multi-call workflow before spending a single cent
  • signed receipts — Ed25519 offline-verifiable proof of every payment
  • session tokens + circuit breaker — per-task spend caps with half-open cooldown
  • transparent 402→pay→retry — native httpx transport, exactly one retry, no loops
  • discovery pipeline — live x402 bazaar indexing (Onyx Bazaar, gold-402)

Open source, no fear

This repo is the open-source SDK: the safe caller, budget guard, idempotency, ledger, CLI and MCP server. MIT licensed.

We don't hide features behind paywalls. We don't split the SDK into "core" and "pro". Everything is here. Use it, fork it, build on it.

The hosted service (https://www.tryx402.app) is the commercial engine: multi-currency fiat billing, margins, FX, Stripe funding, the verified-tools catalogue and the provider portal. Pricing is decided server-side via /v1/quote — a client-side margin is a margin nobody pays.

Revenue model: commission on every pay-per-call transaction routed through the hosted service. The SDK is free. The service takes a cut. That's it.

Positionnement

tryx402 est le premier SDK open source de gouvernance de paiements pour agents IA dans l'écosystème x402. Conçu en France, distribué sous MIT, adopté par la communauté.

Face aux agrégateurs propriétaires (treg.to et consorts), tryx402 défend une position différente : pas de lock-in, pas de licence restrictive, pas de "commercial use only". Le code est libre. La confiance vient du service, pas de la licence.

| Face | Who | Where |\n|---|---|---|\n| Power-tool | you / an agent drive paid endpoints safely | this SDK (gateway.cli, gateway.client) |\n| Fiat gateway | end users pay in their currency, you resell x402 with margin | hosted service (closed) |

Embed it (for agents)

Python — one import:

python
from gateway import Gatewaygw = Gateway(max_budget_usd=1.0)               # safe by defaultdata = gw.call("https://stable-deepline.dev/api/email/validate",               body={"email": "[email protected]"}, price=0.03)print(gw.spent_usd)                            # 0.03

Terminal — one command (like agentcash), after pip install tryx402:

bash
gateway call https://stable-deepline.dev/api/email/validate \  --body '{"email":"[email protected]"}' --price 0.03 --max-budget 0.10

MCP — two modes (pick the one you need):

SDK MCP (pip install) — 6 tools, safe caller only

json
{  "command": "python3",  "args": ["-m", "tryx402.mcp_server"],  "env": { "TRYX402_MAX_BUDGET_USD": "1.00" }}

6 tools: gateway_search, gateway_discover, gateway_call, gateway_spent, gateway_plan, gateway_receipt. Works directly with your x402/AgentCash crypto wallet — no hosted account needed.

You will NOT see gateway_check_balance, gateway_recharge, gateway_lookup, or gateway_proxy_call from pip install tryx402. This is deliberate, not a bug. These tools manage your hosted account credits (funded via Stripe, separate from your crypto wallet). The SDK MCP is a safe x402 caller; the hosted gateway handles the fiat credit layer. For the full 10-tool MCP, see Option B below or connect to https://www.tryx402.app/api/mcp.

Gateway MCP (clone repo) — 10 tools, hosted account management

json
{  "mcpServers": {    "tryx402": {      "command": "python3",      "args": ["-m", "gateway.mcp_server"],      "env": {        "GATEWAY_MAX_BUDGET_USD": "1.00"      }    }  }}

All 6 SDK tools plus gateway_session, gateway_check_balance, gateway_recharge, gateway_proxy_call. No API key needed — anonymous session auth throughout. check_balance / recharge manage your hosted account credits (funded via Stripe in EUR/USD — not crypto).

Layout

gateway/├── client.py    # SafeClient: any endpoint + budget + idempotency + timeout + ledger├── ledger.py    # cost events, USD/EUR totals, by-origin├── catalog.py   # search(intent) / discover(origin) over the AgentCash catalogue├── api.py       # Gateway facade: one-import embed + quote() for server pricing├── cli.py       # search / discover / call / quote└── tests/       # offline: budget, idempotency, on_paid hook, quote client

Use

Discover (free — no payment):

bash
python3 -m gateway.cli search "find work email"python3 -m gateway.cli discover https://stable-deepline.dev

Call any endpoint safely (spends USDC — budget-capped, idempotent):

bash
python3 -m gateway.cli call https://stable-deepline.dev/api/email/validate \  --body '{"email":"[email protected]"}' --price 0.03 --max-budget 0.10

Ask the hosted service what a call costs your account (server-side FX + margin):

bash
export TRYX402_API_KEY="gw_..."        # from https://www.tryx402.appgateway quote 0.04#  -> {"account":"acme","currency":"EUR","charge_minor":5,"charge":"0.05 EUR"}

What's real vs hosted

  • Real (this SDK): the safe caller, budget cap, idempotency, cost ledger, catalogue search/discover.
  • Hosted: accounts, balances, fiat funding (Stripe), FX conversion, margins — all decided by the server; the SDK only asks with quote().
  • Deliberately off: auto-retry of paid calls (default max_retries=0) — retrying a possibly-paid call is what double-charged us; opt in only if the server honors the Idempotency-Key header.

Telemetry (optional)

tryx402 sends one anonymous ping on first import to help us understand usage: install-id (random, persisted locally), package version, Python version, platform.

No PII. No tracking across sites. No personal data.

Disable it anytime:

bash
export TRYX402_NO_TELEMETRY=1

Or set an empty URL to disable:

bash
export TRYX402_TELEMETRY_URL=""

來源:README.md,提交 29c9746

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分