Loomal
The payment + identity layer for AI agents — sellers charge per call in USDC, identities get the wallet, mail, vault, and calendar to transact.
The payment + identity layer for AI agents. Two clean paths depending on which side you're building:
- Sellers charge per call on any HTTP endpoint or MCP tool — five lines of middleware, USDC settles on Base, signed receipt back.
- Identities (the agent side) get a wallet, inbox, vault with TOTP, calendar, and DID in one project.
New here? Start with Introduction for the vocabulary, then pick your path below.
For Sellers
You're shipping a paid API or MCP tool. The middleware handles the x402 dance: serve a 402 challenge, verify the buyer's signed USDC authorization, settle on-chain, return an Ed25519 receipt.
1. Create a project at console.loomal.ai → pick Sell to agents. Flip Pay → Accept on. Copy the API key (loid-...).
2. Install and wrap a handler:
npm install @loomal/sdk expressimport express from "express";
import { Loomal } from "@loomal/sdk";
import { requirePayment } from "@loomal/sdk/paywall/express";
const app = express();
app.set("trust proxy", true);
const loomal = new Loomal({ apiKey: process.env.LOOMAL_API_KEY! });
app.get(
"/search",
requirePayment({ amount: "0.05" }),
(req, res) => res.json({ results: [/* ... */] }),
);
app.listen(3030);Run with LOOMAL_API_KEY=loid-.... That's the whole integration.
Same shape on Hono, FastAPI, and MCP — only the middleware import changes. For frameworks without shipped middleware (Fastify, NestJS, Next.js, raw Node), call loomal.payments.challenge and loomal.payments.redeem from your handler directly.
For Sellers (5-min Quickstart)
The fastest path: create a Seller project, wrap a handler, make a paid call.
Accept Payments (full guide)
The end-to-end Seller flow: frameworks, ngrok testing, webhooks, refunds.
Paid Search API example
Express / Hono / FastAPI variants side-by-side, ready to clone.
For Identities
You're building an agent. It needs a wallet to pay for paid tools — plus an inbox, vault, TOTP, and calendar so it can actually operate. One Loomal Identity project gives you all of it.
Here's an agent paying a seller's endpoint in one call:
import { Loomal } from "@loomal/sdk";
const loomal = new Loomal({ apiKey: process.env.LOOMAL_API_KEY! });
const paid = await loomal.payments.pay({
url: "https://seller.example.com/search",
});
if (!paid.ok) throw new Error(`pay failed: ${paid.code} — ${paid.message}`);
console.log(paid.content); // what the seller returned
console.log(paid.txHash); // on-chain proof on Basepayments.pay() discovers the seller's HTTP 402 challenge, checks your mandate caps, signs an EIP-3009 USDC transfer on your project's Kernel smart account on Base, retries with X-Payment, and returns the seller's content plus the on-chain txHash. Full history at loomal.payments.activity() — no need to store anything yourself. Working end-to-end example at loomal-ai/loomal-pay-examples.
For Agents (one-curl signup)
Agents sign themselves up. No human, no captcha — one API call returns a working Identity.
For Humans (Console signup)
Sign in at console.loomal.ai, create an Identity project, copy the key. The manual path.
Pay for tools
The x402 flow your Identity uses to pay HTTP endpoints and MCP tools.
MCP setup (Claude, Cursor, ChatGPT)
Use Loomal as an MCP server — mail, vault, calendar, identity, no SDK install.