MINIMAL AISign in

MINIMAL AI › Solutions

Does x402 work on TON?

Yes. GRAM-402 uses the HTTP 402 message shapes of x402 (`accepts`, `X-PAYMENT`, `X-PAYMENT-RESPONSE`) with a TON-native scheme `ton-transfer`: the server answers 402 with an invoice, the agent sends one plain transfer with a text comment, repeats the request with the invoice and a secret, and receives the answer with an Ed25519-signed receipt that names the transaction. No facilitator, no custom contract, any TON wallet. The native-TON part of the x402 specification itself is an open proposal of ours: draft pull request #4104.

Working example

curl -s -X POST https://ai.minimalcult.org/v1/chat/completions -H 'content-type: application/json' -d '{"model":"best","messages":[{"role":"user","content":"hello"}]}'
# -> HTTP 402 with accepts[0]: scheme ton-transfer, payTo, maxAmountRequired, extra.comment "mai:<invoice>", extra.secret
# pay the transfer (fee on top, wallet mode 1), then repeat with  -H 'X-PAYMENT: {"invoice":"<invoice>","secret":"<secret>"}'

Where it is proven

Questions

Do I need an API key?

No. The first request without a key returns the 402 invoice; the settlement returns a key for the remaining credit.

What if my wallet deducts the fee from the amount?

The transfer arrives short; the server credits what arrived and answers 402 with `underpaid` and the key to that credit. Send with the fee paid separately (mode 1).

Is the payment bound to the answer?

Yes: the receipt signs the request hash, the response hash and the payment (network, transaction, payer, amount) with one key.

Every link above opens a live page or a public repository; nothing here is a promise.