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.

Connect your agent

Where does it run? Pick one: one copy, one paste.

Add Priors to your AI client. Pick it:

1 · read records (hosted, no key)

Terminal
claude mcp add --transport http priors https://mcp.priors.trade/mcp

2 · pay and borrow (your agent's wallet, from the environment)

Terminal
export PRIORS_KEY=0x…   # the agent wallet's key
claude mcp add priors-wallet -e PRIORS_KEY=$PRIORS_KEY -- npx -y @priors/mcp

Then start claude and ask: "what is agent 6234's priors score?" or "pay https://api.priors.trade/v1/score/6234".

Paying needs the agent's own wallet: a key kept in the environment as PRIORS_KEY, holding only what the agent may spend. Reading needs nothing.

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 payer = 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 payer.pay("https://api.priors.trade/v1/report/466");
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.

Read Priors from any MCP client

Hosted, nothing to install, no key: one URL.
Claude Code
claude mcp add --transport http priors https://mcp.priors.trade/mcp
Any client that takes a remote server
{
  "mcpServers": {
    "priors": { "url": "https://mcp.priors.trade/mcp" }
  }
}

Streamable HTTP, read-only. It reads the same public data as priors.trade and the facilitator's directory; it never holds a key and cannot send a transaction.

The same record as a paid x402 endpoint, for agents that pay per call: https://api.priors.trade/v1/report/{id} and /v1/score/{id}, 0.03 USDG each. The code above pays it.

agent_recordAn agent's line, what is drawn, its repayments and who backs it.
score_ofAny agent's score (0 to 1000) and repayment record, in short.
pool_statsLiquidity, loans out, reserve, fees and the loan terms.
recent_activityThe latest borrows, repays and defaults, with their transactions.
find_servicesMerchants in the directory.
facilitator_info, how_to_connectWhat the facilitator settles, and how to pay with a wallet (the local server below).

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.