Unslept Pay

Charge AI agents per request.

Put a USDG price on any endpoint in a few lines. Agents running Unslept pay on Robinhood Chain and your handler runs only after the payment is verified on chain. The money lands in your wallet, not ours.

How it works

From free endpoint to paid endpoint.

  1. 01

    Install

    Add @unslept/pay to the API you already run. No account, no API key and no dashboard to set up.

  2. 02

    Set a price

    Choose a price per request in USDG and the wallet that receives it. Wrap the route.

  3. 03

    Agents pay

    Agents get a 402 with your price, settle on Robinhood Chain and retry. The package verifies the settlement on chain before your code runs.

  4. 04

    Get listed

    Submit the endpoint to the x402 Directory so agent developers can find it and copy a working snippet.

Integrate

A paywall in twelve lines.

Works with any Fetch-style handler and with Express. Node 20 or later.

npmnpm install @unslept/pay viem
app/api/quote/route.ts
import { createPaywall } from "@unslept/pay";

const paywall = createPaywall({
  payTo: process.env.PAY_TO!,          // your wallet on Robinhood Chain
  price: 10_000n,                      // 0.01 USDG per request
  secret: process.env.PAYWALL_SECRET!, // 16+ characters
  description: "Live quote for one ticker",
});

export const GET = paywall.protect(async (request, payment) => {
  return Response.json({ price: 101.25, paidBy: payment.payer });
});
server.ts
import express from "express";
import { createPaywall } from "@unslept/pay";
import { expressPaywall } from "@unslept/pay/express";

const paywall = createPaywall({
  payTo: process.env.PAY_TO!,
  price: 10_000n,
  secret: process.env.PAYWALL_SECRET!,
});

const app = express();
app.get("/quote", expressPaywall(paywall), (req, res) => {
  res.json({ price: 101.25 });
});
index.ts
import { Hono } from "hono";
import { createPaywall } from "@unslept/pay";

const paywall = createPaywall({
  payTo: process.env.PAY_TO!,
  price: 10_000n,
  secret: process.env.PAYWALL_SECRET!,
});

const app = new Hono();
app.get("/quote", (c) =>
  paywall.protect(async () => Response.json({ price: 101.25 }))(c.req.raw),
);

The details

What you get, exactly.

Settlement
USDG on Robinhood Chain, paid straight to your wallet
Protocol
x402 v2: PAYMENT-REQUIRED, PAYMENT-SIGNATURE, PAYMENT-RESPONSE
Verification
Settled event from the Unslept SettlementRouter, checked per request
Replay protection
Signed, expiring payment IDs; each transaction accepted once
Fees for providers
None. The paying agent covers the settlement fee
License
MIT, open source

Put idle agent money to work.

Create an agent account in a few minutes, or supply the liquidity that settles payments.