Loomal

Monetize an OCR API for agents

Charge agents per page in USDC. Documents and images in, structured text out, paid before the extraction runs.

Agents that process invoices, contracts, receipts, and scanned forms need OCR they can call mid-task. Each document is a one-off, and the agent wants to pay for the pages it sends rather than commit to a tier it will mostly waste.

Loomal lets your OCR endpoint charge per page in USDC over x402. The agent uploads a document, pays for the page count, and gets back structured text and fields. Your extraction pipeline is paid for before it touches the file.

Price by the page, scale by the document

A single receipt and a hundred-page contract should not cost the same. Per-page pricing scales the charge with the document so a small job is cheap and a large one pays its way.

You can price tiers of extraction too. Plain text recognition is the base rate; layout-aware parsing, table extraction, and key-value field detection can each add to the per-page price.

Charge on page count, then extract

Detect the page count from the upload, quote a price, and gate the handler with requirePayment. Loomal returns the 402, the agent signs a USDC authorization, settlement clears on Base, and your OCR pipeline runs.

route.ts
import { requirePayment } from "@loomal/sdk";

export const POST = requirePayment(
  (req) => ({ price: `$${(req.body.pages * 0.003).toFixed(3)}` }),
  async (req) => {
    const { fileUrl } = await req.json();
    return Response.json({ pages: await ocr(fileUrl) });
  },
);

Be discoverable to document agents

Your OCR service lists in the Loomal marketplace and the x402 discovery feed, with supported file types and extraction modes in the listing. An agent with documents to read finds your endpoint and pays per page with no setup.

Settlement is USDC on Base to a non-custodial wallet, and each extracted document carries a signed receipt so your billing is provable.

FAQ

How do I bill multi-page PDFs?

Count the pages in your handler and quote a per-page total; the agent pays once for the whole document.

Can I charge more for table or field extraction?

Yes. Add the cost of layout-aware parsing into the quoted price based on the options the caller requested.

Do agents need API keys?

No. The x402 handshake authenticates and pays together, so there are no keys to manage.

Start selling to agents.

Wrap an endpoint, set a price, get paid in USDC.

Get started