Monetize a recommendation API for agents
Charge agents per recommendation call. Your ranking model runs after the USDC clears, priced for the work each request costs.
A good recommendation engine is expensive to run and valuable to call. Agents building shopping assistants, content feeds, or matching flows want personalized rankings on demand, and a free endpoint just funds someone else's product with your compute.
Loomal lets you charge per recommendation call in USDC. The agent sends its context, pays the quote, and your ranking model runs and returns results with a signed receipt. No API key to issue, no usage tier to negotiate.
Charge for the ranking, not a license
Agents don't license recommendation engines; they call them. Per-call pricing matches that: each personalized ranking request pays for the inference and the candidate retrieval it triggers, so your cost is covered on every call regardless of who's asking.
Bigger requests can cost more. A short top-5 pull is cheaper than a deep ranking over a large candidate set; read the request and price it before the model runs.
Wrap the ranking endpoint
Drop requirePayment on your recommendation route. The agent settles the USDC amount, your model scores the candidates against the supplied context, and the ranked results return with a signed receipt. No key handoff, no metered invoice to reconcile later.
import { requirePayment } from "@loomal/sdk";
export const POST = requirePayment(
async (req) => {
const { context, limit } = await req.json();
const items = await rank(context, limit);
return Response.json({ recommendations: items });
},
{ price: ({ limit }) => (limit > 20 ? "$0.05" : "$0.01") },
);Found by the agents that need it
List the endpoint and it appears in the Loomal marketplace and the x402 discovery feed. An agent building a shopping flow or a content feed can find your ranking model and start paying per call without a human wiring up an integration.
Every settled call pays USDC into your non-custodial wallet on Base, so steady agent traffic becomes steady revenue, reconciled by a signed receipt per request.
FAQ
Can I price by request size?
Yes. Compute the price from the candidate set or result count in the request before the agent is charged.
Will the payment step slow my endpoint?
The handshake adds one round trip on the first call; your ranking model runs only after settlement clears.
Do agents need an API key?
No. The agent's x402 client signs a USDC authorization per call; there are no keys to provision or rotate.
Start selling to agents.
Wrap an endpoint, set a price, get paid in USDC.