Pay-Per-Inference¶
Pay-per-inference is WasiAI's default payment model. Users pay a small fee for each AI inference call, with no subscriptions or commitments required.
Overview¶
Instead of monthly subscriptions, WasiAI enables micropayments for AI usage:
| Traditional Model | WasiAI Model |
|---|---|
| $20/month subscription | $0.01 per call |
| Pay for unused capacity | Pay only for what you use |
| Vendor lock-in | No commitment |
| Opaque pricing | Transparent on-chain |
How It Works¶
User Experience¶
- Find a model in the catalog
- Enter your input (text, data, etc.)
- Click "Run Model"
- Sign in your wallet (no gas required!)
- Receive the result with transaction proof
Behind the Scenes¶
User clicks "Run Model"
│
▼
Frontend requests inference (no payment)
│
▼
Backend returns HTTP 402 + price
│
▼
Frontend prompts wallet signature
│
▼
User signs USDC authorization (gasless)
│
▼
Frontend retries with X-PAYMENT header
│
▼
Backend verifies payment via facilitator
│
▼
Facilitator executes USDC transfer
│
▼
Backend runs AI inference
│
▼
User receives result + txHash
Pricing¶
Typical Price Ranges¶
| Model Type | Price Range | Example |
|---|---|---|
| Simple Classification | $0.001 - $0.005 | Spam detection |
| Sentiment Analysis | $0.005 - $0.02 | News sentiment |
| Text Generation | $0.01 - $0.10 | Content creation |
| Image Analysis | $0.05 - $0.20 | Object detection |
| Complex Reasoning | $0.10 - $1.00 | Code generation |
Price Display¶
Prices are shown in USDC with 4 decimal places: - $0.0100 = 1 cent - $0.0010 = 0.1 cents - $0.0001 = 0.01 cents
Price Limits¶
| Limit | Value | Purpose |
|---|---|---|
| Minimum | $0.0001 | Prevent spam |
| Maximum | $1,000 | UX guardrail |
Gasless Payments¶
Users don't pay blockchain gas fees. Here's why:
EIP-3009: TransferWithAuthorization¶
USDC supports a special function that allows anyone to execute a transfer on behalf of the token holder, as long as they have a valid signature.
User signs message: "I authorize transfer of $0.01 to 0x..."
│
▼
Facilitator submits signature to USDC contract
│
▼
USDC contract verifies signature and transfers
│
▼
Facilitator pays gas, user pays nothing
Why It's Safe¶
- User only signs a specific transfer (amount, recipient, time window)
- Signature cannot be reused (unique nonce)
- Signature expires quickly (60 seconds)
- User never gives up control of their wallet
Payment Flow Details¶
Step 1: Request Without Payment¶
const response = await fetch('/api/inference/1', {
method: 'POST',
body: JSON.stringify({ input: 'Analyze this text...' })
})
// Returns HTTP 402
Step 2: Receive Payment Requirements¶
{
"x402Version": 1,
"accepts": [{
"scheme": "exact",
"network": "avalanche-fuji",
"maxAmountRequired": "10000",
"payTo": "0x...",
"asset": "0x5425890298aed601595a70AB815c96711a31Bc65"
}]
}
Step 3: Sign Authorization¶
const signature = await signTypedDataAsync({
domain: { name: 'USD Coin', version: '2', chainId: 43113, ... },
types: { TransferWithAuthorization: [...] },
message: {
from: userAddress,
to: splitterAddress,
value: 10000n, // $0.01
validAfter: now - 60,
validBefore: now + 60,
nonce: randomBytes32
}
})
Step 4: Retry With Payment¶
const response = await fetch('/api/inference/1', {
method: 'POST',
headers: { 'X-PAYMENT': base64EncodedPayload },
body: JSON.stringify({ input: 'Analyze this text...' })
})
// Returns HTTP 200 with result
Revenue Distribution¶
When you pay for inference, the payment is automatically split:
Payment: $0.10
│
├── Marketplace (5%): $0.005 → WasiAI
├── Creator (10%): $0.0095 → Original creator
└── Seller (85%): $0.0855 → Model owner
This happens automatically via the model's Splitter Contract.
Verifying Payments¶
Every payment is recorded on-chain. You can verify:
Transaction Hash¶
Each inference returns a txHash:
Block Explorer¶
View the transaction on Snowtrace:
Inference History¶
View your history in the WasiAI dashboard: - All inference calls - Amounts paid - Transaction links - Results received
Comparison: Pay-Per-Inference vs Licenses¶
| Aspect | Pay-Per-Inference | License NFT |
|---|---|---|
| Cost Model | Per call | One-time or monthly |
| Best For | Occasional use | Heavy use |
| Commitment | None | Purchase required |
| Gas Fees | None (gasless) | Yes (for purchase) |
| Ownership | No | Yes (NFT) |
| Tradeable | No | Yes |
When to Use Each¶
Use Pay-Per-Inference when: - Testing a model - Occasional usage - Unpredictable volume - Budget constraints
Use License NFT when: - High-volume usage - Predictable needs - Want ownership - Plan to resell access
Troubleshooting¶
"Insufficient USDC Balance"¶
You need USDC in your wallet. Get testnet USDC from: - Circle Faucet
"Signature Rejected"¶
- Make sure you're on the correct network (Avalanche Fuji)
- Try reconnecting your wallet
- Check that the wallet has USDC
"Payment Expired"¶
The 60-second window passed. Click "Run Model" again to generate a new payment.
"Nonce Already Used"¶
This payment was already processed. This is a security feature preventing double-spending.
FAQ¶
Do I need AVAX for gas?¶
No! Pay-per-inference is completely gasless for users. The facilitator pays all gas fees.
What's the minimum payment?¶
$0.0001 (0.01 cents). This prevents spam while enabling true micropayments.
Can I get a refund?¶
Payments are final once confirmed on-chain. Test with small inputs first.
Is my data stored?¶
Your inference inputs are processed but not permanently stored by WasiAI. Check each model's privacy policy.
What if the inference fails?¶
If the AI inference fails after payment, the payment is still processed. This is rare but possible with external model endpoints.