Examples
Paid deep decision — x402 with your own key
Fund a key with USDC on Base, then run catalog signals through the engine — pay per decision.
The full paid loop: wallet setup, the automatic x402 flow, and the honest interpretation of the result (including refusals).
First three questions free. Your first 3 entry-tier questions — S01 Market regime, S05 Volatility expansion, S06 Funding anomaly — are free per payer address, and a refusal never spends one of them. After that, running a decision starts at $1 (1,000 credits): long-window questions are $2, account questions $5, and reading is always free.
1. Set up the wallet
import { privateKeyToAccount } from 'viem/accounts';
// Any EVM account holding USDC on Base (eip155:8453).
export const account = privateKeyToAccount('0x<your private key>');2. Run the deep decision (SDK pays automatically)
import { Tollbridge } from '@tollbridge/sdk-typescript';
import { account } from './wallet';
const paying = new Tollbridge({
baseUrl: 'https://api.tollbridge.app',
x402: {
signer: account,
maxAmountAtomic: '1000000', // defensive cap = the $1 entry tier (1000000 atomic USDC)
},
});
const decision = await paying.decision({ asset: 'BTC', question_id: 'S06_funding_anomaly' });
decision.data.probability; // the recorded probability (0 = no claim made)
decision.data.decision; // publish | monitor | escalate | suppress | …
decision.data.input_hash; // provenance — replayable policy-only
decision.payment; // settlement receipt { success, transaction, network, payer }3. The same flow over raw HTTP (curl)
# 1) challenge
curl -i https://api.tollbridge.app/v1/decisions \
-H 'content-type: application/json' \
-d '{"asset":"BTC","chain":"base","question_id":"S06_funding_anomaly"}'
# → 402, PAYMENT-REQUIRED: <base64>
# accepts[0]: { "scheme": "exact", "network": "eip155:8453", "asset": "USDC",
# "amount": "1000000", "payTo": "…" }
# 1000000 atomic = $1 — the entry tier (S06 Funding anomaly). The challenge, not
# a hardcoded number, is the amount to pay.
# 2) sign the EIP-3009 requirements (any x402 SDK) and retry
curl -i https://api.tollbridge.app/v1/decisions \
-H 'content-type: application/json' \
-H "PAYMENT-SIGNATURE: <base64 payment payload>" \
-d '{"asset":"BTC","chain":"base","question_id":"S06_funding_anomaly"}'
# → 200 with PAYMENT-RESPONSE receipt4. Python (reference snippet — official Python SDK in progress)
import httpx
base = "https://api.tollbridge.app"
H = {"PAYMENT-SIGNATURE": payment_payload_b64, "content-type": "application/json"}
r = httpx.post(
f"{base}/v1/decisions",
headers=H,
json={"asset": "BTC", "chain": "base", "question_id": "S06_funding_anomaly"},
)
decision = r.json()["data"]
assert decision["decision"] in {"publish", "monitor", "escalate", "suppress",
"insufficient_confidence", "stale_input"}Reading the result honestly
probability > 0is a claim;probability == 0with a refusal decision (stale_input,insufficient_confidence,suppress) means no claim was made — read the decision field, not a number.- Funding surfaces ship
assumptions.economics_modeled: "none"— always. A policy verdict is not a trade. - Every decision can be re-verified for free: ledger read + deterministic replay (Decisions).