NEAR protocolUSDC on NEAR

Let your agent spend. Never let it drain.

Your AI agent pays for APIs per call. Ali checks your limits before every single payment.

Built for the agent economy

4 checksbefore every payment
Pay-only keythe agent can't do anything else
No sign-upsno API keys to buy data
One-tap pausestops every payment

Pay per call, the easy way

The NEAR protocol turns any API into a pay-as-you-go service. Three steps, all automatic.

1 · Ask

Your agent asks

It calls an API it has never used. The API replies with a price.

402 Payment Required · 0.01 USDC
2 · Pay

Ali checks, then pays

Your wallet contract checks your limits and sends the USDC.

✓ limits ✓ allowed ✓ paid
3 · Get

The data arrives

The API confirms the payment on NEAR and answers.

200 OK · {"tempC": 8}

Try it in the app

Give an agent a budget, let it buy from paid APIs, then try to break it. Every call shows each step: the 402, the firewall checks, the payment on NEAR and the answer.

  1. Set the limits and pick the APIs the agent may pay
  2. Press Call and watch the agent pay over NEAR
  3. Run an attack and see which rule stops it
Practice

A shared wallet in memory. Instant, nothing to set up.

Your NEAR wallet

Connect MyNearWallet or Meteor on testnet. You get your own budget and 5 test USDC, you sign every rule, and the agent pays on chain.

Spend with built-in limits

1

Max per call

No single payment can go over it.

2

Max per day

A runaway loop stops when the budget runs out.

3

Allowed APIs only

A fake prompt can't send money somewhere new.

4

Pause anytime

One tap, and every payment stops.

The NEAR protocol

An x402-compatible way to pay on NEAR. It lets any API charge per request.

Built on a web standard

The web has a status code for payments: 402 Payment Required. The NEAR protocol uses it. The API answers 402 with a price, the agent pays, then asks again with proof.

Made for NEAR

Every payment goes through the agent's wallet contract, which checks your limits first. The API confirms the USDC transfer on-chain before it answers.

Speaks x402

It speaks x402 v1 and v2, the open payment standard from Coinbase, on NEAR. Agents that know x402 already know it, and any MCP agent can plug in.

Built for developers

TypeScript and a NEAR smart contract. The demo runs offline, with no keys.

npm run demo

          
Sell an API
app.get("/weather",
  paywall({ ledger, price: USDC(0.01),
            payTo: "weather-api.near", asset: "usdc.near" }),
  (req, res) => res.json(getWeather(req)));
Buy from any API
const fetchPaid = createPayingFetch({
  ledger, vault: "marketing.acme.near",
  acceptAssets: ["usdc.near"],
});
// 402 → pay through the wallet → retry.
const res = await fetchPaid("https://api.example/weather");

Try Ali on your laptop

One command starts the app at localhost:3000/app: paid APIs, a wallet with limits, and an agent that pays over NEAR.

npm install && npm start