Charge per request. Skip the sign-up flow.
The openusdc gateway is one line of middleware. It speaks x402, signs receipts, deduplicates payments, and writes a reconciled ledger to your database or to OpenUSDC Cloud.
// Express
import express from "express";
import { openusdc } from "@openusdc/gateway";
const app = express();
app.use(openusdc.gateway({
chain: "base",
payTo: process.env.TREASURY,
routes: {
"POST /v1/score": { price: "0.0040 USDC" },
"POST /v1/predict": { price: "0.0120 USDC", chain: "solana" },
},
}));
app.post("/v1/score", (req, res) => {
res.json({ score: scoreModel(req.body) });
});Price what you actually serve.
The gateway accepts flat, tiered, or programmatic prices. You can price by tokens, by request size, by inference latency, or by your own custom function — without rebuilding billing.
- Flat or per-byte pricing on any HTTP route
- Programmatic pricing — return a price from a hook
- Free-tier carve-outs, daily quotas, and bulk discounts
- Pricing previews in 402 responses so clients can decide
- Per-chain price overrides for L1/L2 settlement differences
openusdc.gateway({
routes: {
"POST /v1/render": {
price: ({ body }) => {
const px = body.width * body.height;
const usd = (px / 1_000_000) * 0.18;
return `${usd.toFixed(4)} USDC`;
},
freeTier: { perDay: 50 },
},
},
});Built for finance, not just engineering.
Reconciled ledger
Every settlement is mirrored into a normalized ledger you can query like Stripe Sigma, but with on-chain provenance attached.
Webhooks & retries
Receive payment.settled, payment.refunded, and payment.disputed events with at-least-once delivery and signed payloads.
Refunds & disputes
One-click refunds within the revocation window; structured dispute flow for chargebacks against a counterparty wallet.
Exports & analytics
CSV, Parquet, and BigQuery exports. Cohort revenue by route, by chain, by agent class, by counterparty.
Alerts & anomalies
Volume drops, refund-rate spikes, suspicious counterparties — sent to Slack, PagerDuty, or your incident channel of choice.
Treasury sweeps
Auto-sweep accumulated USDC to your treasury wallet on a schedule, with policy-driven thresholds and an audit log.
Make your API agent-native this week.
Drop the gateway in front of your handler. Pick a price. Watch the first agent settle a request on-chain — usually within an hour of install.