The Real Problem
Executing digital actions (LLM tokens, GPU inference, third-party API calls, proxy scraping, data processing) creates immediate provider expense. In conventional billing models, providers fund compute execution first and attempt to bill customers later, taking on financial risk.
Real-World Example: For example, an AI generation API or automated research tool could require payment before invoking GPU inference or third-party paid APIs, ensuring compute costs are funded before execution.
How aipp Solves It
aipp gates your compute handler with an HTTP 402 challenge header or Smart Tag. When a client requests execution, aipp returns a payment requirement. Once the Lightning or USDC payment is verified, your backend executes the compute job.
Step-by-Step Payment Flow
STEP 01
Compute Request
Client submits parameters for a resource-intensive job.
STEP 02
402 Invoice
Server issues HTTP 402 challenge with upfront job price.
STEP 03
Payment Settlement
Client settles invoice via Lightning or Base USDC.
STEP 04
Compute Execution
Server verifies payment proof and executes the compute work.
Scope & Boundaries
What aipp Does
- ✓ Exposes a payment requirement before expensive execution starts
- ✓ Verifies Lightning or Base USDC payment settlement proof
- ✓ Allows the protected application to execute after successful verification
- ✓ Auto-forwards net earnings to merchant wallet
What aipp Does Not Do
- ✗ Does not provide LLMs, GPU hardware, proxies, or compute resources
- ✗ Does not calculate underlying cloud costs or meter tokens after execution
- ✗ Does not automatically determine what an action should cost (merchant defines price)
- ✗ Does not perform dynamic post-execution variable bill-back
Implementation Pattern
Below is the minimal implementation pattern using standard aipp endpoints / SDK:
import { Aipp, l402Paywall } from 'aipp-sdk';
// Require upfront payment before executing expensive compute
app.post('/api/compute-job', l402Paywall({
client: aipp,
amountUsd: 0.10
}), async (req, res) => {
const result = await executeExpensiveCompute(req.body);
res.json({ result });
});
Settlement Architecture Note:
• Lightning Rail: In hosted Lightning flows, payments route through aipp's Lightning gateway before net proceeds are automatically forwarded to your configured wallet address.
• Base USDC Rail: USDC transfers settle directly on-chain to your designated EVM wallet address.
• No Merchant Spending Balance: aipp does not maintain a spendable merchant balance or require manual withdrawal steps.
Requirements & Limitations
- aipp requires a known price before execution; it does NOT perform dynamic post-execution token metering or variable bill-back
- Merchant defines the price and hosts the compute infrastructure
- Not appropriate for continuous or unpredictable stream consumption
Frequently Asked Questions
How is this different from Get Paid Before Delivery?
Get Paid Before Delivery protects an existing file or asset. Get Paid Before Compute gates the resource invocation itself so providers do not fund execution costs upfront.
Does aipp track token usage during execution?
No. aipp requires a known price set by the merchant before execution starts. It does not perform dynamic post-execution token metering.
Related Use Cases
Implement Get Paid Before Compute with aipp
Read the developer documentation or generate your API key to gate requests behind Lightning and Base USDC payments.