Skip to main content
tpay curl is a drop-in replacement for curl. It forwards every flag you pass. The difference: when a server responds with 402 Payment Required, tpay settles the payment from your wallet and retries the request — so your agent sees a normal 200 OK.

Make a paid request

tpay curl https://api.weather.ai/forecast
What happens behind the scenes:
1

The request is sent as-is

tpay runs the request exactly like curl would.
2

A 402 is intercepted

If the server returns 402 Payment Required, tpay reads the accepts list — the price, network, token, and recipient.
3

You approve the spend

tpay asks you to authorize the payment (Touch ID on macOS) before signing anything.
4

The payment is attached and retried

tpay builds and signs the Sui payment, attaches it to the request, and sends it again. The server verifies and settles through the facilitator, then returns the resource.

Passing curl flags

Every curl flag works. A few common ones:
# POST with a JSON body
tpay curl -X POST https://api.example.com/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a tentacle holding a coin"}'

# Send a header and follow redirects
tpay curl -H "Accept: application/json" -L https://api.example.com/data

# Include response headers in the output
tpay curl -i https://api.weather.ai/forecast
Don’t set the PAYMENT-SIGNATURE (or X-PAYMENT) header yourself — tpay adds it after you approve the payment. Setting it manually will conflict.

Choosing a wallet

By default tpay curl pays from the active wallet. Use --account to pay from a different one for a single request:
tpay curl --account trading-bot https://api.example.com/data

Networks

tpay pays on whichever network the server’s payment requirements specify — sui:mainnet or sui:testnet. You don’t choose the network for a payment; the seller does, and tpay matches it from the matching wallet balance.

If a payment can’t be made

If the wallet doesn’t have enough balance, or you decline the approval, tpay reports the reason and the request is not retried. Top up the wallet (see Managing wallets) and try again.

Next steps

Connect an agent

Expose pay and get_balance to Claude and other MCP clients.