SpendAuth
SpendAuth lets you pay operators directly on-chain without a credit card or account. Sign an EIP-712 typed data message with your wallet, attach it to the request, and the operator claims payment after serving inference.
How it works
- Sign: Create an EIP-712 SpendAuth payload with your wallet
- Send: Attach the signature as
X-Payment-Signatureheader - Authorize: The gateway verifies the signature and calls
authorizeSpendon-chain - Serve: The operator processes your inference request
- Claim: The operator calls
claimPaymentto receive funds
Request format
curl -X POST "https://router.tangle.tools/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Payment-Signature: {
\"commitment\": \"0xabc...\",
\"serviceId\": \"1\",
\"jobIndex\": 0,
\"amount\": \"1000000\",
\"operator\": \"0x70997970...\",
\"nonce\": \"42\",
\"expiry\": \"1712793600\",
\"signature\": \"0xff...\"
}" \
-d '{"model": "llama-3.1-70b", "messages": [...]}'Security
- EIP-712 signatures: Cryptographically verified against the signing address
- Nonce replay protection: Each nonce can only be used once per commitment (in-memory + Redis store)
- On-chain verification: The
ShieldedCreditscontract validates authorization and deducts balance - Expiry: SpendAuth payloads have a timestamp-based expiry
Rate limits
SpendAuth requests get a generous 120 req/min limit per commitment since every request is paid.
On-chain contracts
SpendAuth uses the ShieldedCredits contract deployed on the Tangle network. The contract handles:
- Balance management (deposit, authorize, claim)
- Authorization verification (EIP-712 signature recovery)
- Payment settlement (operator claims after serving)
The operator-side settlement logic is implemented in tangle-inference-core, a shared Rust crate used by the LLM Inference Blueprint and other inference Blueprints.