The Real Problem
AI agent workloads have variable execution costs depending on task complexity. Forcing users into a single monthly subscription limits power users while turning away light users.
Real-World Example: For example, an AI coding agent could charge $0.25 per multi-step task run, allowing users to pay per execution rather than committing to a monthly plan.
How aipp Solves It
Set upfront task pricing for agent execution runs using aipp Smart Tags or L402 header negotiation. The requesting agent or user pays the specified task fee before execution starts.
Step-by-Step Payment Flow
STEP 01
Task Submission
User or agent submits task goal to agent server.
STEP 02
Task Fee 402
Agent server responds HTTP 402 with task execution fee.
STEP 03
Task Payment
Client pays fee via Lightning or Base USDC.
STEP 04
Agent Runs
Server verifies payment and executes multi-step LLM task.
Scope & Boundaries
What aipp Does
- ✓ Gates AI agent task runs behind verified micropayments
- ✓ Provides machine-readable manifests for agent tool negotiation
- ✓ Auto-forwards net proceeds to developer wallet
What aipp Does Not Do
- ✗ Does not perform dynamic post-execution token metering or variable bill-back
- ✗ Does not calculate LLM compute costs after execution (task price is set upfront)
- ✗ Does not host the LLM or agent orchestration engine
Implementation Pattern
Below is the minimal implementation pattern using standard aipp endpoints / SDK:
from aipp import l402_decorator
@app.route("/api/agent/run", methods=["POST"])
@l402_decorator(amount_usd=0.25)
def run_agent_task():
task = request.json.get("task")
result = execute_agent_loop(task)
return jsonify({"output": 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 task execution; it does NOT currently perform dynamic post-execution token metering or variable billing
- Merchant sets the task price upfront based on expected workload
Frequently Asked Questions
Can I specify different task prices for simple vs complex tasks?
Yes. Your server evaluates task complexity upfront and requests the corresponding invoice amount from aipp before execution starts.
Related Use Cases
Implement Usage-Based AI Agent Tasks with aipp
Read the developer documentation or generate your API key to gate requests behind Lightning and Base USDC payments.