Agent payments

Agent payments are how software agents buy tools and data on their own: the agent reads a price from an HTTP 402, pays per request from its own wallet (x402 or MPP) or a prepaid key, receives a receipt, and stays inside spend limits its operator set in advance.

Why accounts do not work for agents

Most paid APIs assume a person: someone signs up, verifies an email, enters a card and copies an API key into a config file. An agent working through a task cannot do any of that, and giving it a long-lived key to every service it might need is both impractical and risky. What an agent can hold is a wallet with a small balance, or a prepaid key its operator bought for it.

Agent payments replace the account with the payment. The price is stated in the response, the agent pays for that one request, and the payer address on the settled payment is the only identity involved.

The pieces

  • A price the agent can read. An HTTP 402 with machine-readable terms (x402's PAYMENT-REQUIRED, MPP's WWW-Authenticate: Payment), plus catalogs such as /api/pricing and /openapi.json that list prices up front.
  • A way to pay. A stablecoin authorization signed by the agent's own key, a prepaid credits key sent as a Bearer token, or, for pure-CPU tools here, a short proof-of-work puzzle.
  • A receipt. A header on the answer that names the settlement, so spend can be reconciled call by call.
  • Limits. Per-call and daily ceilings enforced by the client before it signs anything.

Limits belong in the client

An agent that can pay can overspend, so the checks that matter run before a payment is signed. The buyer SDK, the MCP server and the AgentKit and elizaOS integrations here take a per-call ceiling and a daily or per-session ceiling and refuse a 402 that asks for more; the buyer SDK also reserves the price of a call before sending it, so concurrent calls cannot overshoot.

import { Agent402 } from "agent402-client";

// Free pure-CPU tools pay with proof-of-work; paid tools use the fetch you pass.
const agent = new Agent402({ fetch: payFetch, maxPerCallUsd: 0.05, dailyLimitUsd: 2 });

const [tool] = await agent.find("extract the main text of a web page");
const page = await agent.call(tool.slug, { url: "https://example.com" });

No wallet yet

Two paths need no wallet. Pure-CPU tools on this server accept a proof-of-work solve instead of money, a fraction of a second of CPU. For everything else, a prepaid card-credits key works on any paid tool: the price is held before the call and debited only on a successful response.

Related