toll-sdk
Python client for Toll's checks on Robinhood Chain (chain id 4663), over Toll's remote MCP server: who is behind a coin, the dev's record, whether there is a real product behind it, what a wallet gives away, an ERC-8004 agent's facts, a pre-sign check before signing, and Robinhood Stock Token data (the token, its company's SEC numbers, insider trades, 13F holders, earnings guidance, the event feed) and US macro. All 29 live tools. Toll reads Robinhood Chain only right now: chain takes only "rh", and a Solana mint or another chain raises TollError "Toll reads Robinhood Chain only right now." before anything is sent. Standard library only, Python >= 3.9, typed.
Information only, not financial advice.
Install
pip install toll-sdk # import name: toll_sdk
Example
from toll_sdk import Toll
toll = Toll()
check = toll.check_coin("0xff9e86e6b21fd688027981bee4b64c8b6b804ed3", chain="rh")
print(check.text) # markdown facts from the chain
larp = toll.larp_check("0xff9e86e6b21fd688027981bee4b64c8b6b804ed3", wait=True)
print(larp.text) # product found / partly found / not found / not read
Every method returns TollResult(text, paid_url, pending). pending ({"retry_after_s": n} or None) means part of the answer is still being read: ask again after that many seconds. paid_url is set when the free coins are used up (see below).
API
Toll(base_url="https://t0ll.xyz", opener=None, timeout=30.0, sign=None, pay_timeout=300.0, toll_key=None, client_id=None, facilitator_url=None) - toll_key (from https://t0ll.xyz/toll#keys) is sent as x-toll-pass on every MCP call and carries your $TOLL tier
check_coin(address, chain=None)- chain isrhor left outlarp_check(token, chain=None, wait=False)-wait=Trueasks again after the seconds the server gives while part of the answer is still being read or Toll is busy with many new LARP checks (max 3 tries, max 120 s)dev_record(wallet, chain=None),launch_record(address),wallet_privacy(wallet),fresh_launches(limit=None),chain_pulse()wallet_approvals(wallet)- a wallet's live token approvals, each with its risk and a revoke call checked by check_tx (text);approvals()for the JSONaccount_permissions(address)- 0.8.0: a Safe or smart account's standing permissions (owners and threshold, modules, guard, fallback handler, Zodiac Roles members and what each may call, a Delay's waiting period, ERC-7579 modules, an EIP-7702 delegate): who can move its funds without the owners signing, and the parts not read (text)check_agent(agent_id)- an ERC-8004 agent on Robinhood Chain by its agent idfind_paid_api(query=None, limit=None)- thefind_paid_apitool: paid APIs (x402) an agent can buy on Robinhood Chain, verified payTo first (text);find_paid_apis()for the JSONpaid_before(payer, pay_to, resource=None, since=None)- whether a wallet already paid you through Toll's facilitator;set_budget,revoke_budget,get_budget- a payer's spending limits with it (live since 2026-11-11); see 0.7.0 belowcheck_hook(address)- one Uniswap v4 hook on Robinhood Chain: name, permissions, upgradeable, pools, sells fail (a holder key adds the measured cut and its latest coins)check_tx(to=, data=, value=, from_=, typed_data=, x402=, agent_id=, registry=, strict=, chain_id=, authorization_list=, message=, origin=, rpc=, user_op=, entry_point=, intent=)- the pre-sign check for a transaction (authorization_listfor an EIP-7702 one), an EIP-712 signature (typed_data), a message to sign (message: personal_sign or eth_sign, withorigin), the wallet request as sent (rpc:{"method", "params"}), an ERC-4337 user operation (user_op,entry_point) or an x402 payment (x402); the last seven inputs are new in 0.7.1: ALLOW / WARN / BLOCK with the reasons, an ERC-8265 RiskAssessment (chain_idonly 4663). Pass on every warning; on BLOCK do not sign without the owner's say.presign_risk_report(subject, context=None, kinds=None)- the Agent Pre-Sign Risk Report (ERC draft, ethereum/ERCs PR #2134, versionerc-presign/1): typed facts about the unsigned request, EIP-712 signed by Toll, no verdictstock_token(id),stock_tokens(query=None, limit=None)- Robinhood Stock Tokens by ticker (NVDA,BRK.B) or contractfundamentals(id, period=None)(ttm,annual,quarterly),insider_trades(id, limit=None)(1 to 100),institutions(id, limit=None)(13F holders, 1 to 20),guidance(id, limit=None)(earnings releases, SEC 8-K Item 2.02, AI-extracted from cited filings, 1 to 60 per release),macro()stock_events(since=None, kind=None, limit=None)- what changed on the Stock Tokens, oldest first (since= the last answer'snext). Without a key: the last 10 events found an hour ago or more; Pro 15 minutes late, Team livetools()lists the server's tools,call(name, args)calls any of them;TOOL_NAMESlists all 29pay(paid_url, sign=None, timeout=None)- pays a paid URL once and returns its JSON (see below)is_valid_address(x),is_valid_wallet(x),is_valid_stock_id(x)- the checks run before anything is sent- Failures (HTTP, JSON-RPC, timeouts, server-side input errors) raise
TollError.
0.7.2: LangChain tools and a time budget
LangChain (pip install "toll-sdk[langchain]", Python 3.10+ for langchain-core 1.x):
from toll_sdk.langchain import toll_tools
tools = toll_tools(budget_ms=1100) # check_coin, pre_buy_check, check_coins, check_tx, check_agent, wallet_approvals, account_permissions (0.8.0), check_hook
# create_agent("openai:gpt-4.1-mini", tools=tools) or llm.bind_tools(tools)
only=[...] picks a subset, prefix="toll_" names them toll_check_coin and so on, toll_key= or client= as in
Toll. Each tool returns Toll's text; an error comes back as one line ("Toll could not answer: ..."), never as a clear
answer. For every Toll tool over MCP, see examples/langchain-mcp.
Time budget for a caller with a timeout: check_tx(..., budget_ms=1100) (300 to 30000 ms; sent to
POST /api/tx/check, the MCP tool takes none, and answered in the same text) and pre_buy_check(address, budget_ms=1100) (300 to 25000 ms). Not read in time = WARN coin-not-read / Decision: WAIT with pending set,
never ALLOW.
0.7.0 (2026-11-10): paid before, seller receipts, budgets
import time
from toll_sdk import Toll, budget_typed_data, revoke_typed_data, receipt_typed_data, toll_offer_receipt_of
toll = Toll()
# 1. paid before: has this wallet already paid me through Toll's facilitator? (for sign-in-with-x sellers)
p = toll.paid_before(wallet, my_wallet, resource="https://api.example/quote", since=1794000000)
if p["paid"]:
... # let the returning wallet in without charging again; p["last"] = {"tx", "ts", "amount", "receiptId", "via"}
# 2. offer-receipt: the seller signs the spec's receipt payload the facilitator hands it, with its own key
x = toll_offer_receipt_of(settle_answer) # extensions["toll-offer-receipt"]: {"offer", "receiptPayload"} or None
if x and x["receiptPayload"]:
td = receipt_typed_data(x["receiptPayload"]) # domain "x402 receipt" / 1 / chainId 1, full-message form
# 3. budgets (live since 2026-11-11; if they are switched off the facilitator answers 404 budgets_off)
from eth_account import Account
from eth_account.messages import encode_typed_data
td = budget_typed_data({"payer": acct.address, "perPayment": 100_000, "perDay": 1_000_000, # USDG base units (6 decimals)
"payToCaps": [{"payTo": "0x...", "perDay": 250_000}], "nonce": int(time.time() * 1000)})
toll.set_budget(td["message"], acct.sign_message(encode_typed_data(full_message=td)).signature)
toll.get_budget(acct.address) # {"budget", "spentToday", "spentByPayTo", "remainingToday", "day"}
rv = revoke_typed_data(acct.address, int(time.time() * 1000))
toll.revoke_budget(acct.address, rv["message"]["nonce"], acct.sign_message(encode_typed_data(full_message=rv)).signature)
paid_before(payer, pay_to, resource=None, since=None)->GET /paid:{"paid", "count", "last", "network", "sources"}(via:settlement,escrow,batch). Only facts already public on chain; a 503 raises, never a false "not paid".sinceis unix seconds or adatetime.- Offer-receipt:
toll_offer_receipt_of(answer),receipt_typed_data(payload),RECEIPT_DOMAIN,RECEIPT_TYPES. The spec's receipt says "paid and delivered", so the seller signs it; Toll never does. - Budgets (live since 2026-11-11):
budget_typed_data(budget)(camelCase or snake_case keys) andrevoke_typed_data(payer, nonce)return EIP-712 typed data in the full-message form (EIP712Domainintypes, ints inmessage), foreth_account'sencode_typed_data(full_message=...)oreth_signTypedData_v4. DomainToll Facilitator Budget/1/ chain 4663, no verifyingContract.set_budget(budget, signature),revoke_budget(payer, nonce, signature),get_budget(payer); a signature may be 0x hex, hex without 0x, or 65 bytes. Rules: perPayment and perDay always apply (0 = nothing passes), perPayTo 0 = not set, payToCaps a day cap per payTo, allowedPayTos empty = any (each at most 50), validUntil 0 = no end, UTC days, a newer nonce replaces. Errors raiseTollErrorwith the facilitator's code (budgets_off,budget_nonce_stale,invalid_budget_signature).
0.6.0 (2026-11-10): find paid APIs, the facilitator's safety screen
All 28 tools of https://t0ll.xyz/mcp (new: find_paid_api), and the discovery catalog of Toll's x402 facilitator
(https://x402.t0ll.xyz, also at https://t0ll.xyz/api/facilitator).
from toll_sdk import Toll, screen_of
toll = Toll()
found = toll.find_paid_apis(query="stock quotes", limit=5) # GET /discovery/search?query=...
for api in found["items"]:
print(api["resource"], api["price"], api["payTo"], api["verified"])
toll.find_paid_apis(pay_to="0x...", operator="agent:8654", type="http", limit=20, offset=20) # GET /discovery/resources
print(toll.find_paid_api(query="weather").text) # the MCP tool, as text
screen_of(settle_answer) # {"outcome": "allow" | "warn" | "block" | "not-read", "codes": [...]} or None
find_paid_apis(query=None, pay_to=None, operator=None, limit=None, type=None, offset=None)->{"x402Version", "items", "pagination", "partialResults"?}; each item:resource,type,accepts,price,payTo,verified(the payTo is the agentWallet its ERC-8004 identity registered, ERC-8478; it does not say the seller delivers),settledViaToll,name,agentId,operator.offsetpages the list only.facilitator_urloverrides where it reads.screen_of(answer)reads and checksextensions.screenof a facilitator/verifyor/settleanswer;not-readis never a refusal.TOLL_FACILITATOR,SCREEN_OUTCOMES.
0.5.0 (2026-11-08): approvals, blocklist, pre-sign record, badges, watches, ALLOW tickets
All 27 tools of https://t0ll.xyz/mcp (new: wallet_approvals, watch_wallet, unwatch_wallet), plus Toll's REST routes.
from toll_sdk import Toll, coin_badge_embed, verify_webhook, append_ticket_suffix
toll = Toll(toll_key=os.environ.get("TOLL_KEY"))
a = toll.approvals(wallet) # GET /api/approvals/{wallet}
if a["state"] == "ok":
for r in a["rows"]:
print(r["risk"], r["token"], r["spender"], r["revoke"]["to"], r["revoke"]["data"])
else:
print("not read, ask again in", a.get("retry_after_s"), "s") # never read it as "no approvals"
bl = toll.blocklist(kind="token") # {"not_modified", "etag", "list"}
bl = toll.blocklist(kind="token", etag=bl["etag"]) # {"not_modified": True, ...} when unchanged
csv = toll.blocklist_file("csv", since="2026-11-08T00:00:00Z")["text"]
rec = toll.tx_record() # check_tx calls scored 24 h later + the weekly calibration
coin_badge_embed(token)["markdown"] # [](https://t0ll.xyz/check/0x...)
w = toll.create_wallet_watch(wallet, "https://your-agent.example/toll") # w["secret"] when w["created"]
ok = verify_webhook(w["secret"], raw_body, headers.get("x-toll-signature"))
r = toll.check_tx(to=to, data=data, value=0, from_=me, ticket=True)
if r.action == "ALLOW" and r.ticket and "ticket" in r.ticket:
data = append_ticket_suffix(data, r.ticket["ticket"], r.ticket["signature"])
approvals(wallet)/approvals_text(wallet)/wallet_approvals(wallet)(the MCP tool, text)blocklist(since=None, kind=None, etag=None),blocklist_file("csv" | "txt", ...). A coin that is not listed is not cleared.tx_record()- the/api/record/txJSONcoin_badge_url(token, size=None),coin_badge_embed(token)->{url, page, html, markdown, react}(alsotoll.badge_url,toll.badge_embed)- Coin watches:
create_coin_watch(token, url),list_coin_watches(),delete_coin_watch(id); eventsverdict_changed,new_against,dev_sold,cluster_sold - Wallet watches:
create_wallet_watch(address, url),list_wallet_watches(),delete_wallet_watch(id)(REST,Authorization: Bearer <key>) orwatch_wallet/unwatch_wallet(MCP); eventsapproval,delegation,risky_token_in verify_webhook(secret, raw_body, signature)/read_webhook(...):x-toll-signature: sha256=<hex HMAC-SHA256(secret, raw body)>, constant-timecheck_tx(..., ticket=True | {"consumer": ..., "scope": "call" | "v4swap"}): the result carries.assessment,.actionand.ticket({ticket, signature, signer}or{why}); a BLOCK is never signed.append_ticket_suffixmatches@tollxyz/guardbyte for byte.
Watches need a Toll key and the server's watch routes open (404 open: false otherwise, raised as TollError).
Free limit and the paid path
10 new coins a day per caller are free (coins already read stay free). Past that, the result carries paid_url, the x402 endpoint for that coin (0.005 USDG on Robinhood Chain, charged only for a whole answer). Markets calls have their own free count (50 a day; 1,000 / 5,000 / 20,000 with 1M / 5M / 20M $TOLL via toll_key); past it, x402 per call: 0.02 USDG a Stock Token, 0.01 USDG for fundamentals, insider trades, institutions (https://t0ll.xyz/api/x402/markets/institutions/{id}), guidance (https://t0ll.xyz/api/x402/markets/guidance/{id}) or macro.
pay(paid_url) runs the x402 flow itself and asks your sign function for one payment:
- GET the URL without payment. Toll answers 402 with what to pay: x402 v2 in the
PAYMENT-REQUIREDheader, v1 in the body. - Call
sign(requirements, url)once. It returns the payment header value. - GET again with it (
PAYMENT-SIGNATUREfor v2,X-PAYMENTfor v1, following what the 402 offered). While Toll is still reading the coin it answers 402{"pending": true}(nothing charged):payresends exactly the same header afterRetry-After(at least 1 s), up to 5 tries and 300 s. A 200 is the answer. Any other 402 after paying raisesTollError"payment not accepted";paynever signs a second payment for one call.
The whole call has its own timeout (pay_timeout, default 300 s). If it times out or the connection drops after the payment was sent, the error says the payment may have settled: do not retry that call with a new signature; resend the same header.
The sign contract
from toll_sdk import PaymentRequirements, Toll
def sign(req: PaymentRequirements, url: str) -> str:
# req.x402_version: 2 when the 402 had a PAYMENT-REQUIRED header, else 1
# req.payment_required: the decoded 402 object; req.accepts: scheme, network "eip155:4663",
# asset (USDG), amount (v2) / maxAmountRequired (v1), payTo, maxTimeoutSeconds, extra
# Check the amount and payTo, sign an EIP-3009 USDG transfer authorization with your x402 client,
# and return the header value for req.x402_version (the base64 payment payload).
...
toll = Toll(sign=sign)
r = toll.check_coin(address)
if r.paid_url:
print(toll.pay(r.paid_url))
Your key never touches this SDK. Without a sign, pay raises before any request. The JavaScript SDK's README has a worked sign built on @priors/x402. Docs: https://t0ll.xyz/agents/plugins, https://t0ll.xyz/llms.txt, https://t0ll.xyz/agents/x402.
MIT.
Metadata
Release files for toll-sdk 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| toll_sdk-0.8.0.tar.gz | 72.5 kB | Without provenance | Details for toll_sdk-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| toll_sdk-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for toll_sdk-0.8.0-py3-none-any.whl |
Total release size: 107.2 kB
Release files / toll_sdk-0.8.0.tar.gz
| Download URL | toll_sdk-0.8.0.tar.gz |
|---|---|
| Size | 72.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe3c2fcc0d1add32f7c07e8210d0761391c59f97fe5affba521cc428c0bc96c1
|
|
BLAKE2b-256 checksum How to use checksums |
b8da6779e0d1e362312977baba1af3382a0c52d2dfc230e16c9263ea2107267a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / toll_sdk-0.8.0-py3-none-any.whl
| Download URL | toll_sdk-0.8.0-py3-none-any.whl |
|---|---|
| Size | 34.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f20d8e89fe2c894270fc7ff3c247aa474a9dbdd33bdc9f2d0514b946797c73f1
|
|
BLAKE2b-256 checksum How to use checksums |
132d0afd6bd27c591e74a8a62d8a4dce11c5876d5b9b81556f9b2aed390c1ba9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for toll-sdk 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.