x402 · agents

Pay anything. Borrow the gap.

Your agent pays x402 prices in USDG on Robinhood Chain from its own wallet. When it is short and has a Priors line, it borrows only the difference, and repays when it gets paid.

Pay from code

A fetch that answers 402 by paying, within the limits you set.
agent.js
// npm i @priors/x402 ethers
import { ethers } from "ethers";
import { createPayer, robinhood } from "@priors/x402";

// the agent's own wallet: a key kept in the environment, holding only what it may spend
const provider = new ethers.JsonRpcProvider("https://rpc.mainnet.chain.robinhood.com");
const signer = new ethers.Wallet(process.env.PRIORS_KEY, provider);

const pay = createPayer({
  signer,
  pool: robinhood.pool,  // optional, with agentId: borrow the gap from its Priors line
  agentId: 437n,         // its ERC-8004 id
  maxPrice: 100_000n,    // never pay more than $0.10 for one call (USDG has 6 decimals)
  maxBorrow: 5_000_000n, // never borrow more than $5 for one call; 0 never borrows
});

// a fetch that pays a 402: what it paid and borrowed, in atomic USDG
const { response, paid, borrowed, dueAt } = await pay("https://api.example.com/report");
console.log(response.status, await response.json(), { paid, borrowed, dueAt });

maxPriceThe most one call may pay. The merchant names the price, so a higher one is refused before anything is signed.
maxBorrowThe most one call may borrow. Leave out pool and agentId, or set maxBorrow to 0, and it only ever pays from balance. A loan returns its dueAt.
one signatureEach call signs one transfer, valid for at most 600 seconds. If settling is still pending, it resends that same payment; it never signs a second one for the same call.

Pay from Claude, or any MCP client

A local MCP server with your agent's wallet behind it.
claude_desktop_config.json
{
  "mcpServers": {
    "priors": {
      "command": "npx",
      "args": ["-y", "@priors/mcp"],
      "env": { "PRIORS_KEY": "0x… the agent wallet's key" }
    }
  }
}

pay_urlCall a paid URL and pay its price, up to max_price.
wallet_balanceUSDG in the agent's wallet.
credit_statusIts line, what is drawn, and when it is due.
borrow, repayDraw from the line for a number of days; repay one loan or all of them.
score_ofAny agent's Priors record.
find_servicesMerchants in the directory.

How credit works for payments

Not leverage. Float: the few dollars that pay for the call that earns the next ten.
i.

It borrows only the gap

When a price is above the agent's USDG balance, the payer borrows the shortfall from the agent's Priors line (at least the pool's minimum loan), pays, and keeps the rest for the next calls. With enough balance, it borrows nothing.

ii.

It repays when it gets paid

A loan for payments runs seven days by default. The fee is the pool's, one percent per thirty days, and the agent repays when its own clients pay it. Every repayment lengthens its record.

iii.

A line needs someone behind it

Paying works for any wallet. Borrowing needs an ERC-8004 identity with a Priors line, and a line needs a backer who pays first if the agent walks. Volume through the hub never opens a line by itself.

Ask for a first line on the seats page, or back an agent on Participate.