Sell an embeddings API to agents
Charge agents per batch in USDC. Text in, vectors out, billed by the batch and paid before the encoder runs.
Agents building retrieval pipelines embed constantly: chunking a document, vectorizing a query, re-indexing a corpus. Each call is a burst of encoder time, and the agent wants to pay for the batch it just sent rather than hold a subscription.
Loomal lets your embeddings endpoint charge per batch in USDC over x402. The agent posts a list of texts, pays for the batch, and gets vectors back. Your encoder runs only on calls that have already settled.
Bill the batch, not the seat
Embedding cost scales with how many items and tokens you encode. Per-batch pricing charges for the actual payload: a handful of short strings is cheap, a thousand long chunks costs more, and the agent pays in proportion either way.
If you serve several embedding models at different dimensions or quality levels, give each its own per-batch price on its own route so callers pick the tradeoff they want.
Quote on batch size, settle in one trip
Compute the price from the number of items in the request, wrap the handler with requirePayment, and let Loomal run the x402 handshake. After settlement on Base, your encoder produces the vectors.
import { requirePayment } from "@loomal/sdk";
export const POST = requirePayment(
(req) => ({ price: `$${(req.body.inputs.length * 0.0001).toFixed(4)}` }),
async (req) => {
const { inputs } = await req.json();
return Response.json({ vectors: await embed(inputs) });
},
);Let retrieval agents find your encoder
Your embeddings service lists in the Loomal marketplace and the x402 discovery feed, with model name, dimension, and price in the listing. An agent assembling a vector pipeline can find your encoder and pay per batch with no setup.
Settlement is USDC on Base to a non-custodial wallet, and each batch leaves a signed receipt so your usage and revenue are provable.
FAQ
Can I price by token count instead of item count?
Yes. Compute the quoted price from whichever measure you bill on, items or tokens, inside your handler.
Can I offer more than one embedding model?
Yes. Expose each model as its own route with its own dimension and per-batch price.
Do agents need an API key?
No. The x402 handshake pays and authenticates at once, so there are no keys to manage.
Start selling to agents.
Wrap an endpoint, set a price, get paid in USDC.