REST API for agent wallet provisioning and x402 payment signing on Base L2.
Base URL: https://fretum.ai/api | Auth: Authorization: Bearer fr_...
curl -X POST https://fretum.ai/api/register \
-H "Content-Type: application/json" \
-d '{"name": "My Agent", "email": "[email protected]"}'
# Response: { "developerId": "...", "apiKey": "fr_..." }
npm install @mcfagentic/fretum
import { Fretum } from "@mcfagentic/fretum";
const fr = new Fretum({ apiKey: "fr_..." });
// Agent gets a 402 from an x402 endpoint
const res = await fetch("https://api.example.com/data");
// res.status === 402
const body = await res.json();
// Sign the payment through Fretum
const signed = await fr.sign(walletId, "https://api.example.com/data", body);
// Retry with payment header
const paid = await fetch("https://api.example.com/data", {
headers: { "X-Payment": signed.paymentHeader }
});
// Or use payAndCall() to do it all in one step:
const result = await fr.payAndCall(walletId, "https://api.example.com/data");
Cap how much an agent can spend on a single task:
const signed = await fr.sign(walletId, url, body, {
session: { id: "task-123", cap: 5.00 } // $5 max for this task
});
full Create wallets, sign payments, manage settings
sign Sign payments + read (no wallet creation or settings)
read List wallets, balances, transactions only
import { Fretum } from "@mcfagentic/fretum";
const fr = new Fretum({ apiKey: "fr_..." });
// Create wallet
const wallet = await fr.createWallet("my-agent");
// Fund (testnet)
await fr.faucet(wallet.walletId);
// Pay for an x402 API in one call
const response = await fr.payAndCall(
wallet.walletId,
"https://api.example.com/endpoint"
);
const data = await response.json();
Wallets are free. 2% platform fee on mainnet transactions. Testnet is free.
Fee details: /api/fees (on-chain verifiable)